Trains the technique from
LeetCode 2593Sum SmallerThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A tray holds the readings readings.
Return how many triples of positions i < j < k have readings[i] + readings[j] + readings[k] strictly below limit.
Example 1
The tray has one triple and it totals nothing, which is below one.
Example 2
The one triple totals 3, which is not strictly below 3.
Example 3
The three readings total -300, comfortably below the limit.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def three_sum_smaller(readings: list[int], limit: int) -> int:public int threeSumSmaller(int[] readings, int limit)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.