Permutation Game Hackerrank Javascript Questions