Generate all permutations of an array | SoFi Interview Question