• + 1 comment

    Yeah, my bad. It's O(1) per query, but an O(n) space complexity algorithm in the end.