Anki Interview Question

next permutation finding anagram solved