Next Permutation Problem Leetcode Javascript Questions