Pergunta de entrevista da empresa Amazon

It was a leetcode question involving bit shifting and permutations.