-
Notifications
You must be signed in to change notification settings - Fork 47
Space - Lak #24
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
base: master
Are you sure you want to change the base?
Space - Lak #24
Conversation
CheezItMan
left a comment
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.
Not bad, hit you most of all the learning goals here with some problems, you can see my comments for more information.
Take a look at my comments and let me know if you have any questions.
| #Time complexity: O(n+m) | ||
| #Space complexity: O(n) | ||
| def intersection(list1, list2) |
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+m+l) | ||
| #Space complexity: O(n^2) | ||
|
|
||
| def palindrome_permutation?(string) |
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.
The time complexity is O(n^2) because unshift has O(n) and you're doing it n times. The space complexity O(n) as well.
You seem to be trying to check to see if the string is a palindrome. The problem states that you are checking to see if the letters could be re-arranged into a palindrome.
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.
Ah...I went back to see the problem. I misunderstood the problem. My mind was thinking about the palindrome that I did a few weeks ago.
| #Time complexity: O(n+m) | ||
| #Space complexity: O(n) | ||
| def permutations?(string1, string2) |
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 will fail for heelo and hello. You should instead count the number of times each letter occurs.
No description provided.