Permutation Game Hackerrank Solution For Sql