3Sum Smaller
Two Pointer
Problem
Given an array arr
of unsorted numbers and a target sum, count all triplets in it such that arr[i] + arr[j] + arr[k] < target
where i
, j
, and k
are three different indices. Write a function to return the count of such triplets.
For example:
Solution
Last updated
Was this helpful?