DataStork interview question

Design solution for MaxProfit calculation for an array