Created
May 20, 2020 14:54
-
-
Save venelrene/331aa23c303a1afad6256ce600471bb3 to your computer and use it in GitHub Desktop.
Suzuki needs help lining up his students! Today Suzuki will be interviewing his students to ensure they are progressing in their training. He decided to schedule the interviews based on the length of the students name in descending order. The students will line up and wait for their turn. You will be given a string of student names. Sort them an…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def lineup_students(names) | |
names.split.sort_by {|name| [name.length, name] }.reverse | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment