Conversation
CheezItMan
left a comment
There was a problem hiding this comment.
Nice work Emily, you hit the learning goals here. Well done. I do suggest you look at my suggestions and see if you can see ways to convert the methods into O(n) time/space complexity.
| # Time complexity: O(n), where n is the length | ||
| # Space complexity: O(n), uses up some space in the call stack until it reaches the base case | ||
| def factorial(n) |
| # Time complexity: O(n^2) | ||
| # Space complexity: O(n^2) | ||
| def reverse(s) |
| # Time complexity: O(n) | ||
| # Space complexity: O(n) | ||
| def reverse_inplace(s) |
| # Time complexity: O(n) | ||
| # Space complexity: O(n) | ||
| def bunny(n) |
| # Time complexity: O(n^2) | ||
| # Space complexity: O(n^2) | ||
| def nested(s) |
There was a problem hiding this comment.
👍 However can you see a way, like with reverse_inplace to do it with O(n) time/space complexity?
| # Time complexity: O(n^2) | ||
| # Space complexity: O(n^2) | ||
| def search(array, value) |
There was a problem hiding this comment.
👍 However can you see a way, like with reverse_inplace to do it with O(n) time/space complexity?
| # Time complexity: O(n^2) | ||
| # Space complexity: O(n^2) | ||
| def is_palindrome(s) |
There was a problem hiding this comment.
👍 However can you see a way, like with reverse_inplace to do it with O(n) time/space complexity?
| # Time complexity: O(n^2)? | ||
| # Space complexity: O(n^2)? | ||
| def digit_match(n, m) |
There was a problem hiding this comment.
👍 However can you see a way, like with reverse_inplace to do it with O(n) time/space complexity?
No description provided.