set11

List every order the team can be photographed in

11 / 26
read the snippet · pick its Big-O
function teamOrders(people) {
if (people.length <= 1) return [people];
const out = [];
for (let i = 0; i < people.length; i++) {
const rest = [people.slice(0, i), people.slice(i + 1)];
for (const p of teamOrders(rest)) out.push([people[i], p]);
}
return out;
}