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

Amber Lynn - Edges | reverse_words #37

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

Conversation

griffifam
Copy link

had trouble figuring out how to skip over spaces

ender = 0

my_words.length.times do |i|
ender = i

Choose a reason for hiding this comment

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

To take care of multiple consecutive, white spaces, at the beginning of the times' loop you could check if my_words[start] is a white space. If it is, update, start to be i+1 and continue to the next iteration in the times' loop, otherwise, continue on with the rest of your logic.

@shrutivanw
Copy link

Nice work!

Take a look at my solution at https://github.com/Ada-C10/reverse_words/blob/solution/lib/reverse_words.rb

Slack me if you have any questions on my comments or my solution or deducing the time and space complexity.

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.

2 participants