package leetcode;

/**
 * https://leetcode.com/problems/global-and-local-inversions/
 */
public class Problem775 {
    public boolean isIdealPermutation(int[] A) {
        for (int i = 0; i < A.length; i++) {
            // TODO
        }
        return true;
    }

    public static void main(String[] args) {
        Problem775 prob = new Problem775();
        System.out.println(prob.isIdealPermutation(new int[]{1, 0, 2})); // true
        System.out.println(prob.isIdealPermutation(new int[]{1, 2, 0})); // false
        System.out.println(prob.isIdealPermutation(new int[]{3, 2, 1, 0})); // false
        System.out.println(prob.isIdealPermutation(new int[]{0, 1, 2, 3})); // true
    }
}

@@ -218,474 +218,112 @@
     
-// TODO%0A        %7D%0A        return true;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        Problem775 prob = new Problem775();%0A        System.out.println(prob.isIdealPermutation(new int%5B%5D%7B1, 0, 2%7D)); // true%0A        System.out.println(prob.isIdealPermutation(new int%5B%5D%7B1, 2, 0%7D)); // false%0A        System.out.println(prob.isIdealPermutation(new int%5B%5D%7B3, 2, 1, 0%7D)); // false%0A        System.out.println(prob.isIdealPermutation(new int%5B%5D%7B0, 1, 2, 3%7D)); // true
+if (Math.abs(A%5Bi%5D - i) %3E 1) %7B%0A                return false;%0A            %7D%0A        %7D%0A        return true;
 %0A   

Update problem 775