permutations problem on leetcode

visit shbcf.ru