Targeted sum
Start Timer
0:00:00
Given an integer list nums with length n and an integer target, find three integers in nums that yield a sum closest to target.
Return the sum of these three integers.
You can assume that each input will have exactly one solution.
Example:
Input:
nums = [-1, 2, 1, -4]
target = 1
Output:
2
Explanation:
The sum that is closest to the target is (-1) + 2 + 1 = 2.
.
.
.
.
.
.
.
.
.
Comments