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

Branches- Erika #46

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Branches- Erika #46

wants to merge 7 commits into from

Conversation

emaust
Copy link

@emaust emaust commented Nov 14, 2019

No description provided.

Copy link

@CheezItMan CheezItMan left a 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)

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)

Choose a reason for hiding this comment

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

👍

if s.length == 1 || s == ""
return s
else
return reverse(s[1..-1]) + s[0]

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

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