剑指offer python版 数组中的逆序对
def aa(nums): if not nums: return False leng=len(nums)-1 ret=[] for i in range(leng): for j in range(i,leng): if nums[i]>nums[j]: ret.append([nums[i],nums[j]]) j +=1 return ret print(aa([2,3,3,4,2,2,1,4,5,2]))
def aa(nums): if not nums: return False leng=len(nums)-1 ret=[] for i in range(leng): for j in range(i,leng): if nums[i]>nums[j]: ret.append([nums[i],nums[j]]) j +=1 return ret print(aa([2,3,3,4,2,2,1,4,5,2]))