Permutation Game Hackerrank Javascript User