Back to problems

4Sum (Find all unique quadruplets)

Algorithm · Snapchat · Medium

Given an integer array nums along with an integer target, find every unique group of four values [nums[a], nums[b], nums[c], nums[d]] whose indices a, b, c, and d are all different and whose total is target. Requirements: List the numbers within each quadruplet in non-decreasing order. Do not return the same quadruplet more than once. Constraints: 0 <= len(nums) <= 200 -10^9 <= nums[i] <= 10^9 -10^9 <= target <= 10^9 I/O format (ACM style): Input: first line n, second line…

Checking your access…