-
Notifications
You must be signed in to change notification settings - Fork 43
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
Raisah #28
base: master
Are you sure you want to change the base?
Raisah #28
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.
Very nice work including Sudoku. Take a look at my comments and let me know if you have questions. Otherwise excellent work!
# Time Complexity: O(nm) because the method will always iterate through each string (n) in strings and then each string will be compared to all hashes (m) that have been created, which in the worst case could be the same as the number of strings | ||
# Space Complexity: O(n) because the size of anagrams_grouped and hash_groups will grow linearly with the size of strings in the worse case | ||
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.
This works with good time/space complexity, but could use with some refactoring.
# Time Complexity: O(nlogn) because the sort_by method will have the time complexity of quick sort | ||
# Space Complexity: O(n) because the size of the variables will change linearly with the size of list | ||
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.
👍 Correct, nice work
# Time Complexity: O(n) because at method must go through the table 3 times to check for each sceniario to be valid (row, column, 3x3 grid) | ||
# Space Complexity: O(1) because the size of the variables created is constant. (if the grid is greater than 9x9 this might change for the corners array) | ||
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.
This works, but the method is pretty long and could use some refactoring. Maybe breaking some things into helper methods.
Hash Table Practice
Congratulations! You're submitting your assignment!
Comprehension Questions