SHARE
TWEET

Stuff

a guest Aug 25th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. using namespace std;
  5.  
  6. int Solution (vector<int> T) {
  7.     int answer = 0;
  8.     int max_so_far = T[0];
  9.     int last_max = T[0];
  10.     for (int i(1); i < T.size(); ++i) {
  11.         if (max_so_far > T[i]) {
  12.             answer = 0;
  13.             max_so_far = last_max;
  14.         }
  15.         else {
  16.             answer++;
  17.             last_max = T[i];
  18.         }
  19.     }
  20.     return T.size() - answer;
  21. }
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