Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

my solution #111

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

my solution #111

wants to merge 1 commit into from

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