Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.* ;
- import java.io.*;
- public class Solution {
- public static long getInversions(long arr[], int n) {
- // Write your code here.
- long ans=0;
- for(int i=0; i<n; i++){
- for(int j=i+1;j<n;j++){
- if(arr[i] > arr[j]){
- ans++;
- }
- }
- }
- return ans;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement