IntegraFEC Interview Question

How would you solve this programming problem?