Capgemini Interview Question

Asked to solve pseudocode puzzles.