max profit version 2