-
Notifications
You must be signed in to change notification settings - Fork 48
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
Branches- Erika #46
base: master
Are you sure you want to change the base?
Branches- Erika #46
Conversation
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.
What you have work, although your reverse-in-place method doesn't do it it in place. Also you didn't answer the time/space complexities.
@@ -3,19 +3,35 @@ | |||
# Time complexity: ? | |||
# Space complexity: ? | |||
def factorial(n) |
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.
👍
end | ||
|
||
|
||
|
||
# Time complexity: ? | ||
# Space complexity: ? | ||
def reverse(s) |
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.
👍
lib/recursive-methods.rb
Outdated
if s.length == 1 || s == "" | ||
return s | ||
else | ||
return reverse(s[1..-1]) + s[0] |
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 right here creates a new array, and so is not in place
No description provided.