Step 1: Sort the list to [-4, -1, -1, 0, 1, 2]
[-4] -> [-1] -> [-1] -> [0] -> [1] -> [2] -> null
Why: Sorting helps to use two pointers and avoid duplicates easily
Step 2: Set first pointer i=0 at -4, set left=1, right=5
i->[-4], left->[-1], right->[2]
Why: Start checking pairs with -4 to find sum zero triplets
Step 3: Calculate sum = -4 + (-1) + 2 = -3 < 0, move left pointer right
i->[-4], left->[-1 (index 2)], right->[2]
Why: Sum too small, increase sum by moving left pointer right
Step 4: Calculate sum = -4 + (-1) + 2 = -3 < 0, move left pointer right
i->[-4], left->[0], right->[2]
Why: Sum still too small, move left pointer right again
Step 5: Calculate sum = -4 + 0 + 2 = -2 < 0, move left pointer right
i->[-4], left->[1], right->[2]
Why: Sum still less than zero, move left pointer right
Step 6: Calculate sum = -4 + 1 + 2 = -1 < 0, move left pointer right
i->[-4], left->[2], right->[2]
Why: Left and right pointers meet, no triplet with i=0
Step 7: Increment i to 1 at -1, set left=2, right=5
i->[-1], left->[-1], right->[2]
Why: Try next number as first element of triplet
Step 8: Calculate sum = -1 + (-1) + 2 = 0, record triplet [-1, -1, 2], move left and right pointers skipping duplicates
triplets: [[-1, -1, 2]]
i->[-1], left->[0], right->[1]
Why: Found a valid triplet, move pointers to find others
Step 9: Calculate sum = -1 + 0 + 1 = 0, record triplet [-1, 0, 1], move left and right pointers
triplets: [[-1, -1, 2], [-1, 0, 1]]
i->[-1], left->[1], right->[0]
Why: Found another valid triplet
Step 10: Left pointer meets right pointer, increment i to 2 at -1 (skip duplicate), then i=3 at 0
i->[0], left->[1], right->[2]
Why: Skip duplicate i and continue searching
Step 11: Calculate sum = 0 + 1 + 2 = 3 > 0, move right pointer left
i->[0], left->[1], right->[1]
Why: Sum too big, decrease sum by moving right pointer left
Step 12: Left and right pointers meet, end search
triplets: [[-1, -1, 2], [-1, 0, 1]]
Why: No more triplets possible
Result: [-1] -> [-1] -> [2] -> null
[-1] -> [0] -> [1] -> null
All unique triplets that sum to zero