摘要:
Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may comple 阅读全文
摘要:
public class S053 { //kadane's algorithm //(如果不止一个数时)最大子数组第一个数肯定大于零,从最大子数组中某个数开始往前的数之和肯定大于零 public int maxSubArray(int[] nums) { if(nums.length == 0) return 0; ... 阅读全文
摘要:
public class S121 { public int maxProfit(int[] prices) { //TLE /* if(prices.length0;i--){ prices[i] = prices[i]-prices[i-1]; } for(int i = 1;iresult) ... 阅读全文
摘要:
configure: error: Could not link test program to Python. Maybe the main Python library has been installed in some non-standard library path. If so, pa 阅读全文