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

Hayden - Edges - C10 " reverse sentence " coding challenge #22

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

Conversation

haydenwalls
Copy link

The time complexity of this algorithm is O(n) because it has to iterate over each character of the string. The space complexity is also O(n) because a new array is created in memory that contains all characters of the input string.

@shrutivanw
Copy link

Good job on thinking through a working algorithm for this problem and explanation of the time and space complexity.

Here's an alternative solution with a better space complexity: https://github.com/Ada-C10/reverse_sentence/blob/solution/lib/reverse_sentence.rb Let me know if you have any questions on it.

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