-
Notifications
You must be signed in to change notification settings - Fork 48
Leaves -- Cloudy #46
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
base: master
Are you sure you want to change the base?
Leaves -- Cloudy #46
Conversation
CheezItMan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't working and it's clear from the tests it's not working. You do have reversing a string done, but little else is in place. I'm glad you got what you finished in, but take a look at my comments and let me know if they give you an idea where you could have proceeded from there.
| initial += 1 | ||
| last -= 1 | ||
|
|
||
| return sentence |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This return should be outside the while loop
| (min..max).each do |length| | ||
| sky_arr.each do |word| | ||
| if word.length == length | ||
| final_arr << word | ||
| end | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like it works, but it's a little inefficient. Instead you could just do a bubblesort using the string lengths.
| # shovel into my_new_array | ||
| # in a perfect world, would return in order we want | ||
|
|
||
| def reverse(sentence) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method reverses a string, it doesn't reverse the words in a sentence. You're on the right track.
Consider:
- Reverse the string
- Loop through reversing each word in the sentence.
Sorting & Reverse Sentence