class Solution(object):
def inversePairs(self, data):
“”“
:type nums: List[int]
:rtype: int
“”“
if len(data)<=0:
return 0
# ls=data.copy() #python3有copy函数,python2报错
ls=[]
for i in range(len(data)):
ls.append(data[i])
ls.sort()
i=0
count=0
while len(ls)>i:
count+=data.index(ls[i])
data.remove(ls[i])
i+=1
return count