Maximum K to Sort a Permutation | Leetcode 3644