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

Earth - Lina #28

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

Earth - Lina #28

wants to merge 5 commits into from

Conversation

lina5147
Copy link

@lina5147 lina5147 commented Nov 3, 2020

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.

Well done Lina, take a look at my comments especially regarding the reverse_inplace method. Let me know what questions you have via Slack.

Comment on lines +3 to 5
# Time complexity: O(n)
# Space complexity: O(n)
def factorial(n)

Choose a reason for hiding this comment

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

👍

Comment on lines +16 to 18
# Time complexity: O(n^2)
# Space complexity: O(n^2)
def reverse(s)

Choose a reason for hiding this comment

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

👍

Comment on lines 28 to 30
# Time complexity: ?
# Space complexity: ?
def reverse_inplace(s)

Choose a reason for hiding this comment

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

⚠️ This is not in place. You are creating new strings with each recursive call. Instead of modifying the original string.

Think about adjusting the method signature to this.

def reverse_inplace(s, low = 0, high = s.length - 1)

Does this help you see a way to do it in-place.

Comment on lines +38 to 40
# Time complexity: O(n)
# Space complexity: O(n)
def bunny(n)

Choose a reason for hiding this comment

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

👍

Comment on lines 48 to 50
# Time complexity: O(n^2)
# Space complexity: O(n^2)
def nested(s)

Choose a reason for hiding this comment

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

👍 , however can you see a way to do this O(n) in time/space?

Comment on lines 60 to 62
# Time complexity: O(n^2)
# Space complexity: O(n^2)
def search(array, value)

Choose a reason for hiding this comment

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

👍

Comment on lines 72 to 74
# Time complexity: O(n^2)
# Space complexity: O(n^2)
def is_palindrome(s)

Choose a reason for hiding this comment

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

👍

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