-
Notifications
You must be signed in to change notification settings - Fork 40
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
Ari #7
base: master
Are you sure you want to change the base?
Ari #7
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, I like how you thought to break down the Sudoku problem into smaller methods. You got all the problems here. Nice work!
# Checks whether there is any | ||
# duplicate in current column or not. | ||
def in_column?(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.
These in_row and in_column methods don't look very dry here.
end | ||
end | ||
|
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.
Minor thing: I suggest a return true
here.
# Checks whether there is any duplicate | ||
# in current 3×3 box or not. | ||
def in_box?(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 is a really slick method! Nice
# Space Complexity: ? | ||
# in the case of a tie it will select the first occurring element. | ||
# 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.
Nice work!
# Time Complexity: ? | ||
# Space Complexity: ? | ||
# in the case of a tie it will select the first occurring element. | ||
# Time Complexity: O(n) |
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.
Looking at your later loop, I would say this is O(k * n)
# This method will return an array of arrays. | ||
# Each subarray will have strings which are anagrams of each other | ||
# Time Complexity: ? | ||
# Space Complexity: ? | ||
# Time Complexity: O(n) |
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.
Assuming the words are small, this is correct.
Hash Table Practice
Congratulations! You're submitting your assignment!
Comprehension Questions