1 min readJul 27, 2019
Early in the write-up, you stress the desire for O(1) memory, but the use of the hashmap means that you are using O(m) memory, where m is the size of the set you are looking for. That isn’t the same as O(1) as you didn’t give any indication that m << n in the initial description.