Skip to content

Conversation

@easternwashingaden
Copy link

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.

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.

Comment on lines +1 to 3
#Time complexity: O(n+m)
#Space complexity: O(n)
def intersection(list1, list2)

Choose a reason for hiding this comment

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

👍

Comment on lines +1 to 4
#Time complexity: O(n+m+l)
#Space complexity: O(n^2)

def palindrome_permutation?(string)

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.

Copy link
Author

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.

Comment on lines +1 to 3
#Time complexity: O(n+m)
#Space complexity: O(n)
def permutations?(string1, string2)

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.

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