Tap here to switch tabs
Problem
Submissions

Problem: 3Sum Closest

med
30 min
Try to solve the 3Sum Closest problem.

Statement

Given an integer array nums and an integer target, return the sum of three integers in nums whose value is closest to target.

You may assume that each input has exactly one solution.

Note: The solution is guaranteed to be unique.

Constraints:

  • 3≤3 \leq nums.length ≤500\leq 500

  • −1000≤-1000 \leq nums[i] ≤1000\leq 1000

  • −104≤-10^4 \leq target ≤104\leq 10^4

⋮
Tap here to switch tabs
Problem
Submissions

Problem: 3Sum Closest

med
30 min
Try to solve the 3Sum Closest problem.

Statement

Given an integer array nums and an integer target, return the sum of three integers in nums whose value is closest to target.

You may assume that each input has exactly one solution.

Note: The solution is guaranteed to be unique.

Constraints:

  • 3≤3 \leq nums.length ≤500\leq 500

  • −1000≤-1000 \leq nums[i] ≤1000\leq 1000

  • −104≤-10^4 \leq target ≤104\leq 10^4