Uber ATG | Phone Screen | 3Sum Greater
2250

Given an array of n integers nums and an int target, find the number of index triplets i, j, k with 0 <= i < j < k < n that satisfy the condition nums[i] + nums[j] + nums[k] > target.

Example:

Input: nums = [2, 1, 3, 0, 3], target = 5
Output: 5
Explanation:
[0, 3, 3]
[1, 3, 3]
[1, 2, 3]
[1, 2, 3]
[2, 3, 3]

Related problems:

Comments (4)