How Many Numbers Are Smaller Than the Current Number

Given an array, find out for each element how many numbers in the array are smaller than it. Return the results in a new array.

Constraints

  • 2 <= nums.length <= 500
  • 0 <= nums[i] <= 100
Saving… · 2 lines
class Solution:
def smallerNumbersThanCurrent(self, nums: List[int]) -> List[int]:
Console

Click Run to execute sample tests.