Codility's MaxProfit