publicstaticintmaxProfit(int k, int[] prices){ /** * java.lang.ArrayIndexOutOfBoundsException: Index 2 out of bounds for length 2 * at line 7, Solution.maxProfit * at line 57, __DriverSolution__.__helper__ * at line 87, __Driver__.main */ if(prices.length==0){ return0; } //当k>一半的时候,相当于可以每隔一天进行交易,直接调用122题的贪心算法即可
Posted onValine: Symbols count in article: 357Reading time ≈1 mins.
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.