Step 1: Sort the list to make it easier to find quadruplets
[-2, -1, 0, 0, 1, 2]
Why: Sorting helps skip duplicates and use two pointers efficiently
Step 2: Fix first number at index 0 (-2), then fix second number at index 1 (-1)
First two fixed: [-2, -1], searching pairs in [0, 0, 1, 2]
Why: We try to find two numbers that sum with -2 and -1 to target 0
Step 3: Use two pointers: left at index 2 (0), right at index 5 (2), sum = -2 + -1 + 0 + 2 = -1
Sum -1 < target 0, move left pointer right
Why: Sum too small, need bigger numbers
Step 4: Left pointer moves to index 3 (0), sum = -2 + -1 + 0 + 2 = -1 again
Sum still -1 < 0, move left pointer right
Why: Still too small, try next number
Step 5: Left pointer moves to index 4 (1), sum = -2 + -1 + 1 + 2 = 0
Sum equals target, quadruplet found: [-2, -1, 1, 2]
Why: Found one valid quadruplet
Step 6: Move left pointer right and right pointer left to avoid duplicates
Left at 5, right at 4, pointers crossed, end inner loop
Why: No more pairs for these fixed numbers
Step 7: Fix first number at index 0 (-2), second number at index 2 (0)
Searching pairs in [0, 1, 2]
Why: Try new second number to find other quadruplets
Step 8: Two pointers left=3 (0), right=5 (2), sum = -2 + 0 + 0 + 2 = 0
Quadruplet found: [-2, 0, 0, 2]
Why: Found another valid quadruplet
Step 9: Move pointers to avoid duplicates, then continue searching
Pointers crossed, end inner loop
Why: No more pairs for these fixed numbers
Step 10: Fix first number at index 1 (-1), second number at index 2 (0)
Searching pairs in [0, 1, 2]
Why: Try new first number to find more quadruplets
Step 11: Two pointers left=3 (0), right=5 (2), sum = -1 + 0 + 0 + 2 = 1
Sum 1 > target 0, move right pointer left
Why: Sum too big, try smaller number
Step 12: Right pointer moves to index 4 (1), sum = -1 + 0 + 0 + 1 = 0
Quadruplet found: [-1, 0, 0, 1]
Why: Found another valid quadruplet
Step 13: Move pointers to avoid duplicates, then end inner loop
Pointers crossed, no more pairs
Why: No more pairs for these fixed numbers
Result: [-2, -1, 1, 2] -> [-2, 0, 0, 2] -> [-1, 0, 0, 1]