Earlier quoted context omitted.
>But the hashmap guy might accidentally say it's O(N) memory (common mistake for frequency maps) Wait why is it O(1) memory for the frequency map? As you keep adding elements doesn't the hashmap have to resize to prevent too many hash collisions? > finding if an unsorted list of numbers is an arithmetic series with just O(1) memory Is the strategy to solve this to first find the common difference `d` with one pass th…
> >But the hashmap guy might accidentally say it's O(N) memory (common mistake for frequency maps) > Wait why is it O(1) memory for the frequency map? As you keep adding elements doesn't the hashmap have to resize to prevent too many hash collisions? Presumably because you'll have a constant number of keys (I'm not sure what the exact problem he's referring to is).
I'm not sure how you would have a constant number of keys. I mean I guess if you consider a worst-case hash table with bucket for each integer you would have 2^32 keys (which is technically O(1) space since the size remains fixed regardless of list length).
But using Big-O in this case is clearly disingenuous since the space allocated is far, far more than the one for xor solution.