Skip to content

Four Sum ​

Four Sum — LeetCode

Find all unique quadruplets in the array that sum to a given target.

Approach ​

Sort the array. Fix two elements, Search for Two Sum. Best complexity is $n^3$

Remarks ​