World Wide Technology interview question

Algorithm question. Solve and write pseudo code on the white board.