Concept Flow - Four Sum Problem All Unique Quadruplets
Sort the array
Fix first element i
Fix second element j
Use two pointers left and right
Check sum of nums[i
Repeat until left >= right
Move j to next unique element
Move i to next unique element
End when i reaches length-4
The algorithm sorts the array, then uses two nested loops to fix the first two numbers. For the remaining two numbers, it uses two pointers moving inward to find quadruplets that sum to the target, skipping duplicates to ensure uniqueness.
