Dashboard Temp Share Shortlinks Frames API

HTMLify

LeetCode - How Many Numbers Are Smaller Than the Current Number - Python
Views: 614 | Author: abh
1
2
3
4
5
6
7
class Solution:
    def smallerNumbersThanCurrent(self, nums: List[int]) -> List[int]:
        smallercount = []
        sortednums = sorted(nums)
        for n in nums:
            smallercount.append(sortednums.index(n))
        return smallercount