Domanda di colloquio di Fuse (Canada)

How would you solve problem in linear time