United Airlines Interview Question

How to calculate the optimal values and make programs