-
Notifications
You must be signed in to change notification settings - Fork 41
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
Charlotte - Space #29
base: master
Are you sure you want to change the base?
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.
Nice work Charlotte, you hit most of the learning goals with just 1 test failing. You also need to take a look at time complexity a bit. This is something to work on here.
# Time Complexity: 0(1) | ||
# Space Complexity: 0(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.
👍 , however your time complexity is off. You loop through all the strings so it's a minimum of O(n). If you assume the strings are all small then the sorting can be ignored.
lib/exercises.rb
Outdated
# Time Complexity: 0(1) | ||
# Space Complexity: 0(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.
This is most of the solution, the only weakness is that the sort_by
you're doing doesn't preserve the order the elements were encountered in. You also have the time complexity wrong because you have a loop through all the elements and you're sorting them.
Hash Table Practice
Congratulations! You're submitting your assignment!
Comprehension Questions