Pregunta de entrevista de World Wide Technology

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