LeetCode Solutions/LeetCoding Challenge/April 2021 LeetCoding Challenge/Global and Local Inversions/Global and Local Inversions.java
<reponame>DevashishPathrabe/LeetCodeclass Solution {
    public boolean isIdealPermutation(int[] A) {
        for (int i=0; i<A.length; i++){
            if (i-A[i] > 1 || i-A[i] < -1){
                return false;
            }
        }
        return true;
    }
}