Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Best Time to Buy and Sell Stock II

a guest Apr 8th, 2020 176 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int maxProfit(int* prices, int pricesSize){
  2.     int cnt = 0;
  3.     for(int i = pricesSize - 1; i > 0; i--){
  4.         if(prices[i] > prices[i - 1])
  5.             cnt += prices[i] - prices[i - 1];
  6.     }
  7.    
  8.     return cnt;
  9. }
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
Top