Return the number of triples of positions i < j < k with nums[i] + nums[j] + nums[k] < target.
For nums = [-2, 0, 1, 3] and target = 2 the answer is 2 (-2 + 0 + 1 and -2 + 0 + 3).
The starter code tries every triple. It is correct but too slow for long lists.
Example 1
Input:
count_triplets_smaller([-2, 0, 1, 3], 2)
Output:
2
Example 2
Input:
count_triplets_smaller([], 0)
Output:
0
0 <= len(nums) <= 1000-1000 <= nums[i] <= 1000-3000 <= target <= 3000No results yet
Run your code to check it against the examples, or submit to run every test.