MCPcopy Create free account
hub / github.com/HuberTRoy/leetCode / Solution

Class Solution

Array/CountOfSmallerNumbersAfterSelf.py:28–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26import bisect
27
28class Solution(object):
29 def countSmaller(self, nums):
30 """
31 :type nums: List[int]
32 :rtype: List[int]
33 """
34
35 x = []
36 result = []
37
38 for i in nums[::-1]:
39 result.append(bisect.bisect_left(x, i))
40 bisect.insort(x,i)
41
42 return result[::-1]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected