Pregunta de entrevista de Fuse (Canada)

How would you solve problem in linear time