Pergunta de entrevista da empresa 89 Degrees

Asked to write a simple code on a whiteboard.