Question d’entretien chez Fuse (Canada)

How would you solve problem in linear time