Search
⌘K

Leetcode 775. Global and Local Inversions

Given a permutation nums of 0..n-1, determine whether every global inversion is also a local inversion (i.e., the counts are equal). This is equivalent to checking that there are no inversions between elements separated by two or more indices — no pair (i, j) with j >= i+2 and nums[i] > nums[j].


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.