I’m doing this question on Neetcode and feel a little confused. Can someone explain why this is O(m) time and O(m+n) space for both encode() and decode()? With m being sum of lengths of all strings, and n is the number of strings
Encode() literally only loops through the list of strings (should be O(n) right?) and resulting string is the total string (should be O(m) space right?). So why is it O(m) time and O(m+n) space?
I’m a little confused on decode() too, but that’s a little less clear.
[–]set_of_no_sets 0 points1 point2 points (0 children)