Stock max profit interview question resolved