-
Notifications
You must be signed in to change notification settings - Fork 39
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 #14
base: master
Are you sure you want to change the base?
Earth - Beauttie #14
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.
Really nice work here Beauttie. You hit the learning goals here. Well done.
lib/exercises.rb
Outdated
# Time Complexity: O(n^2) | ||
# Space Complexity: O(n) | ||
|
||
def grouped_anagrams(strings) |
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.
👍 Interesting solution with char.ord
This works if you know that all the letters are a-z and roughly the same length. That's because you could end up with two strings of different lengths that have the same sum of characters.
# Time Complexity: O(n) | ||
# Space Complexity: O(n) | ||
def top_k_frequent_elements(list, k) |
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.
👍 I like the O(n) solution here.
return true | ||
end | ||
|
||
def valid_boxes(table) |
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.
I like the helper methods here.
# Time Complexity: ? | ||
# Space Complexity: ? | ||
# Time Complexity: O(1) because the table has nine rows and columns | ||
# Space Complexity: O(1) because each hash will store up to nine cells | ||
def valid_sudoku(table) |
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.
👍
Hash Table Practice
Congratulations! You're submitting your assignment!
Comprehension Questions