1365. How Many Numbers Are Smaller Than the Current Number
On This Page
class Solution:
def smallerNumbersThanCurrent(self, nums: List[int]) -> List[int]:
cnt = [0] * 102
for x in nums:
cnt[x + 1] += 1
s = list(accumulate(cnt))
return [s[x] for x in nums]