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

Time - Angela #34

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

Time - Angela #34

wants to merge 3 commits into from

Conversation

angethuy
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.

Outstanding work, you hit all the learning goals here. Well done.

Take a look at my comments and let me know if you have any questions.

Comment on lines +2 to 4
#Time complexity: O(n), worse case scenario we iterate over every item in both lists
#Space complexity: O(n), creating a new hash and a new array
def intersection(list1, list2)

Choose a reason for hiding this comment

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

👍 And correct time/space complexity

Comment on lines +3 to 6
# Time: O(n), we iterate over the string once and over our hash once
# Space: O(n), worse case scenario we create a new hash collection that's as "large" as our string

def palindrome_permutation?(string)

Choose a reason for hiding this comment

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

👍 Nicely done.

Comment on lines +1 to 7
# Accepts two strings as arguments and checks if they're permutations of each other.
# Permutations share the same letter counts between each other.
# Time: O(n), we iterate through three different collections of fixed size
# Space: O(n), we create a new hash


def permutations?(string1, string2)

Choose a reason for hiding this comment

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

👍 nice work!

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