Advertisement
ann8497

minimse the rows

Feb 8th, 2023
1,279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.27 KB | Source Code | 0 0
  1. // link https://leetcode.com/discuss/interview-question/1371222/Google-Questions
  2. void f(vector<int> &v){
  3.     map<int,int> m;
  4.     for(auto &c: v){
  5.         auto t=m.upper_bound(c);
  6.         if(t!=m.end()) m.erase(t->first);
  7.         m[c]=1;
  8.     }
  9.     cout<<m.size()<<" ";
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement