https://leetcode.com/problems/3sum/
Time complexity: O(n*n) Space complexity: O(n)
Time complexity: O(n*n) Space complexity: O(n)
Time complexity: O(n*n) Space complexity: O(n)
While the asymptotic complexity is the same, this algorithm is noticeably slower than the previous approach. Lookups in a hashset, though requiring a constant time, are expensive compared to the direct memory access.