4 Sum | Find Quads that add up to a target value
Given an array nums of integers and an integer target, return all unique quadruplets [a, b, c, d] such that: a + b + c + d == target The result must not contain duplicate quadruplets and the quadruplets can be in any order. Example 1 Input : nums = [ 1 , 0 , - 1 , 0 , - 2 , 2 ] target = 0 Output : [ [ - 2 , - 1 , 1 , 2 ] , [ - 2 , 0 , 0 , 2 ] , [ - 1 , 0 , 0 , 1 ] ] Example 2 Input : nums = [ 2 , 2 , 2 , 2 , 2 ] target = 8 Output : [ [ 2 , 2 , 2 , 2 ] ] Constraints 1
~ HackFury
⏱️05 October 2025