Next Permutation | Leetcode | Java | Intuition/Theory and code in java