-
Notifications
You must be signed in to change notification settings - Fork 53
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 - Beauttie #38
base: master
Are you sure you want to change the base?
Earth - Beauttie #38
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.
Overall well done Beauttie. Take a look at my comments and let me know what questions you have.
# Time complexity: O(n) | ||
# Space complexity: O(n) | ||
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.
👍
# Time complexity: O(n^2) | ||
# Space complexity: O(n^2) | ||
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.
👍
# Time complexity: O(n) | ||
# Space complexity: O(n) | ||
def reverse_inplace(s, first = 0, last = s.length - 1) |
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.
👍
# Time complexity: O(n) | ||
# Space complexity: O(n) | ||
def bunny(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.
👍
# Time complexity: O(n^2) | ||
# Space complexity: O(n^2) | ||
def nested(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.
👍 , but could you do this with O(n) space/time complexity?
# Time complexity: O(n^2) | ||
# Space complexity: O(n^2) | ||
def search(array, value) |
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.
👍 , but could you do this with O(n) space/time complexity?
# Time complexity: O(n) | ||
# Space complexity: O(n) | ||
def is_palindrome(s, first = 0, last = s.length - 1) |
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.
👍 , Well done!
# Time complexity: O(log n) | ||
# Space complexity: O(log n) | ||
def digit_match(n, m, num_matches = 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.
👍
lib/recursive-methods.rb
Outdated
# Time complexity: O(n) | ||
# Space complexity: O(n) | ||
def fib(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.
👍 Nice getting it written, but the time complexity is O(2^n)!
No description provided.