Bridgenext Interview Question

Max Profit aptitude question