public void Excution1Test() { var func = new MaxProfit2(); Assert.AreEqual(7, func.Excution1(new[] { 7, 1, 5, 3, 6, 4 })); Assert.AreEqual(4, func.Excution1(new[] { 1, 2, 3, 4, 5 })); Assert.AreEqual(0, func.Excution1(new[] { 7, 6, 4, 3, 1 })); }
public int MaxProfit(int[] prices) { var profit = new MaxProfit2(prices); return(profit.GetMaxProfit2()); }