题目标题

输出序列的逆序对

参考解析
  1. class Solution1:
  2. def InversePairs(self, data):
  3. # write code here
  4. start_time = time.clock()
  5. if data == []:
  6. end_time = time.clock()
  7. return 0, end_time - start_time
  8. else:
  9. num = 0
  10. while len(data) > 1:
  11. num += data.index(min(data))
  12. data.pop(data.index(min(data)))
  13. end_time = time.clock()
  14. return num % 1000000007, end_time - start_time