赞
踩
最近在leetcode上做了一道题(No.315),查看一份耗时较少的代码时,发现其思路与其他的做法不同,没有采用“分治”的思想,但同样达到了较高的效率。
You are given an integer array nums and you have to return a new counts array. The counts array has the property where counts[i] is the number of smaller elements to the right of nums[i].
Example:
Given nums = [5, 2, 6, 1]
To the right of 5 there are 2 smaller elements (2 and 1).
To the right of 2
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。