You are viewing a single comment's thread. Return to all comments →
public static long stockmax(List<int> prices) { var profit = 0L; var max = prices.Count()-1; while(max > 0){ var i = max-1; while(i >= 0 && prices[i] <= prices[max]){ profit += prices[max] - prices[i]; i--; } max = i; } return profit; }
Seems like cookies are disabled on this browser, please enable them to open this website
Stock Maximize
You are viewing a single comment's thread. Return to all comments →