Skip to content

Conversation

@vickicello
Copy link

No description provided.

#Put your code here!

sorted_arr = array.sort { |x, y| x.length <=> y.length }
sorted_arr[0]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done! Since you are returning the first index of an array, you might want to use the first method, mainly for readability 😄


#Put your code here!

if integer >= 90

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! An alternate solution might be to use a case statement.

case integer
when 80..90
  ...
end


#Put your code here!

sorted_arr = array.sort { |x, y| x.length <=> y.length }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to consider using min_by here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants