Check if the current selling price is less than that of the previous transactions
while ( ! transaction . isEmpty ( ) && prices [ sell - 1 ] > prices [ transaction . peek ( ) [ 1 ] - 1 ] ) { int [ ] p = transaction . peek ( ) ;