Fuse (Canada) Interview Question

How would you solve problem in linear time