SHARE
TWEET

Untitled

bbescos Jan 28th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     int maxProfit(vector<int>& prices) {
  2.         int acc = 0;
  3.         for (int i = 1; i < prices.size(); ++i) {
  4.             if (prices[i] > prices[i - 1])
  5.                 acc += prices[i] - prices[i - 1];
  6.         }
  7.         return acc;
  8.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top