<codility> maxprofit challenge