Unique Quadruplets

ARRAY

Problem

Given an array of integers nums and an integer target, return the number of all unique quadruplets [a, b, c, d] in nums such that a + b + c + d = target.

The solution set must not contain duplicate quadruplets.

Examples

uniqueQuads([1,0,-1,-3,0,4], 0); // returns 2 // Quadruplets: [ [ -3, -1, 0, 4 ], [ -1, 0, 0, 1 ] ]
Loading...