Amazon | Phone | Target Sum Pro
Anonymous User
2596

Level:
New Grad

Postion:
SWE

Problem:
Given an unsorted list of integers, return all combinations of 4 integers such that a + b + c = z where a, b, c, and z are all integers in the given list. Each element of the list may only be used once in each combination. Note: The interviewer discouraged sorting the inputted list.

Example:

Input: [9, 3, 2, 1, 6]
Output: [1, 2, 3, 6], [1, 2, 6, 9]
Comments (9)