https://www.hackerrank.com/challenges/permutation-game/