Tap here to switch tabs
Problem
Submissions

Problem: 3Sum Smaller

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

Statement

Given an integer array nums of length n and an integer target, return the number of triplets of indices (i, j, k) satisfying 0≤i<j<k<n0 \leq i < j < k < n such that nums[i] ++ nums[j] ++ nums[k] << target.

Constraints:

  • n ==== nums.length

  • 0≤0 \leq n ≤3500\leq 3500

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

  • −100≤-100 \leq target ≤100\leq 100

  • The input is generated such that the answer is less than or equal to 10910^9.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: 3Sum Smaller

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

Statement

Given an integer array nums of length n and an integer target, return the number of triplets of indices (i, j, k) satisfying 0≤i<j<k<n0 \leq i < j < k < n such that nums[i] ++ nums[j] ++ nums[k] << target.

Constraints:

  • n ==== nums.length

  • 0≤0 \leq n ≤3500\leq 3500

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

  • −100≤-100 \leq target ≤100\leq 100

  • The input is generated such that the answer is less than or equal to 10910^9.