Conversation
|
Grabbing this to grade! |
chimerror
left a comment
There was a problem hiding this comment.
Good work!
I added some comments about extraneous comments and your time complexity calculation for the Top-K problem, but otherwise this looks good enough for a Green.
| # ["ate","eat","tea"], | ||
| # ["nat","tan"], | ||
| # ["bat"] | ||
| # ] |
There was a problem hiding this comment.
As a style thing, you'll usually want to remove comments like this that are not really related to explaining why the code is designed a certain way.
|
|
||
|
|
||
| # Input: nums = [1,1,1,2,2,3], k = 2 | ||
| # Output: [1,2] |
There was a problem hiding this comment.
Same as above, you can probably remove comments like these after they've helped you write your code.
| 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.
Don't forget to account for the call to sorted, which takes O(n * log(n)) time, and thus dominates the O(n) part of this algorithm giving a final time complexity of O(n * log(n)).
Hash Table Practice
Congratulations! You're submitting your assignment!
Comprehension Questions