United Airlines interview question

How to calculate the optimal values and make programs