Fuse (Canada) interview question

How would you solve problem in linear time