Bridgenext interview question

Max Profit aptitude question