Whatfix interview question

DSA Next Permutation coding question on notepad