Trains the technique from
LeetCode 1365How Many Numbers Are Smaller Than the Current NumberThis 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 bake-off has finished and nums[i] is the panel score awarded to entry i, on a scale from 0 to 100.
The organisers want a card for every entry saying how many entries it beat outright. For entry i that is the number of positions j with j != i and nums[j] < nums[i]. Entries that tie on score beat each other zero times.
Return an array out of the same length as nums, where out[i] is the count for entry i, in the same order as the input.
Example 1
Each 7 beats the 2 and the 4 but not the other 7, so both get 2; the 2 beats nothing; the 4 beats only the 2.
Example 2
All five entries tie, so none of them beats another and every card reads 0.
Example 3
The lowest score beats nothing and the highest beats the one entry below it.
Example 4
Each 9 sits above the 1, 5, 1 and 0, giving 4; each 1 sits above only the 0; the 5 sits above the two 1s and the 0.
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 strictly_below_counts(points: list[int]) -> list[int]:public int[] strictlyBelowCounts(int[] points)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.