Given a list of integers and a target sum, find all unique triplets in the list that sum up to the target value. The challenge is to handle duplicates efficiently and consider various edge cases.
For list [-1, 0, 1, 2, -1, -4] and target_sum = 0:
Implement the find_triplets function to find all unique triplets that sum to the target value. Consider using techniques like sorting and two-pointer approach for efficiency.
Found two unique triplets that sum to zero
Single triplet using three 1s from the list
Single triplet of zeros, duplicates handled