LeetCode 31. Next Permutation

This is one of the trickier problems on LeetCode that requires a solid understanding of permutations and array manipulation. The problem…