Added another alternative to get_max_profit