Skip to content

Commit c66fc97

Browse files
pkmm91blakeembrey
authored andcommitted
closest sum
Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target.
1 parent 2744e3a commit c66fc97

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

problems/closest-sum/problem.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target.
2+
Return the sum of the three integers.
3+
You may assume that each input would have exactly one solution.
4+
5+
Example:
6+
given array S = {-1 2 1 -4},
7+
and target = 1.
8+
9+
The sum that is closest to the target is 2. (-1 + 2 + 1 = 2)

0 commit comments

Comments
 (0)