LC 0259 [M] 3Sum Smaller - ALawliet/algorithms GitHub Wiki
class Solution:
def threeSumSmaller(self, arr: List[int], target: int) -> int:
arr.sort()
count = 0
n = len(arr)
for i in range(n - 2)):
l, r = i + 1, n - 1
while l < r:
s = arr[i] + arr[l] + arr[r]
if s < target:
count += r - l
l += 1
else:
r -= 1
return count