HTMLify

LeetCode - How Many Numbers Are Smaller Than the Current Number - Python
Views: 141 | Author: abh
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

Comments