count-of-smaller-numbers-after-self.py 文件源码

python
阅读 36 收藏 0 点赞 0 评论 0

项目:lc-all-solutions 作者: csujedihy 项目源码 文件源码
def countSmaller(self, nums):
        """
        :type nums: List[int]
        :rtype: List[int]
        """
        ans = []
        bst = []
        for num in reversed(nums):
            idx = bisect.bisect_left(bst, num)
            ans.append(idx)
            bisect.insort(bst, num)
        return ans[::-1]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号