122. Best Time to Buy and Sell Stock II

大概意思是否是隻找最大差值,而是把全部的差值所有找出來it 網上某個大佬提供了一個很巧妙的思路,就是把後一個減去前一個,而後獲得差值若是大於零就加上去return int maxProfit(int* prices, int pricesSize)  {     int i=1,profit=0;     for(;i<pricesSize;i++)     {         if(prices
相關文章
相關標籤/搜索