diff --git a/DynamicProgramming/BestTimeToBuyAndSellStocks-II.cpp b/DynamicProgramming/BestTimeToBuyAndSellStocks-II.cpp index f58fc90..5f52123 100644 --- a/DynamicProgramming/BestTimeToBuyAndSellStocks-II.cpp +++ b/DynamicProgramming/BestTimeToBuyAndSellStocks-II.cpp @@ -6,9 +6,10 @@ int Solution::maxProfit(const vector &A) { // Do not print the output, instead return values as specified // Still have a doubt. Checkout www.interviewbit.com/pages/sample_codes/ for more details - vector temp(A.size(), 0); + // vector temp(A.size(), 0); - int buy = A[0], flag = 0, i = 1, max_sell = INT_MIN; + // int buy = A[0], flag = 0, i = 1, max_sell = INT_MIN; + if(A.size() == 0 || A.size() == 1) return 0; int sol = 0; while(i < A.size()){ int diff = A[i] - A[i-1];