Tap here to switch tabs
Problem
Submissions

Problem: 3Sum With Multiplicity

med
30 min
Try to solve the 3Sum With Multiplicity problem.

Statement

Given an integer array arr and an integer target, return the number of tuples (i, j, k) such that i < j < k and arr[i] + arr[j] + arr[k] is equal to target.

Since the result can be very large, return the answer modulo 109+710^9 + 7.

Constraints:

  • 3≤3 \leq arr.length ≤3000\leq 3000

  • 0≤0 \leq arr[i] ≤100\leq 100

  • 0≤0 \leq target ≤300\leq 300

⋮
Tap here to switch tabs
Problem
Submissions

Problem: 3Sum With Multiplicity

med
30 min
Try to solve the 3Sum With Multiplicity problem.

Statement

Given an integer array arr and an integer target, return the number of tuples (i, j, k) such that i < j < k and arr[i] + arr[j] + arr[k] is equal to target.

Since the result can be very large, return the answer modulo 109+710^9 + 7.

Constraints:

  • 3≤3 \leq arr.length ≤3000\leq 3000

  • 0≤0 \leq arr[i] ≤100\leq 100

  • 0≤0 \leq target ≤300\leq 300