1 public class Solution { 2 public int InversePairs(int[] array) { 3 if(array.length == 0) { 4 return 0; 5 } 6 int result = 0; 7 for(int i = 0; i < array.length - 1; i ++) { 8 for(int j = i + 1; j < array.length; j ++) { 9 if(array[i] > array[j]) { 10 result ++; 11 } 12 } 13 } 14 return result % 1000000007; 15 } 16 }
原文:https://www.cnblogs.com/StringBuilder/p/14759160.html