Last updated
Was this helpful?
Last updated
Was this helpful?
Supports the same grammar for the problem statement, as the Perl solution.
Adding more people and floors requires changing the list that's being used for the permutations, adding a variable for the new person, a piece of output in the string and finally to adjust all mentions of the "top" floor. Adjusting to different rules requires changing the multi-line if statement in the loop.