Conversation
|
Grabbing this to grade! |
chimerror
left a comment
There was a problem hiding this comment.
Good work!
I had some comments about your time complexity calculation for the anagrams problem and an unused import statement, but overall this looks good enough for a Green.
| Each subarray will have strings which are anagrams of each other | ||
| Time Complexity: ? | ||
| Space Complexity: ? | ||
| Time Complexity: O(nlog(n)) |
There was a problem hiding this comment.
My guess is that you noticed your call to sorted and are accounting for that, with n referring to the number of characters in the strings (as that's what affects how long sorted takes).
However, don't forget about the number of strings in the list (let's call that m), which will call sorted each time for O(m * n * log(n)).
But the good news is that we can actually make a simplifying assumption! Since we know the strings are English words, and English words tend to be limited in length (about 5 letters on average), the effect of n is going to be dwarfed by m, the number of strings in strings. There may be hundreds or thousands of strings in strings, after all. With that we can give the time complexity as O(n).
| @@ -1,19 +1,45 @@ | |||
|
|
|||
| from typing import OrderedDict | |||
There was a problem hiding this comment.
Looks like this import statement never got used. In general, just to keep the code clean, you probably want to remove unused imports like these.
Hash Table Practice
Congratulations! You're submitting your assignment!
Comprehension Questions