Advertisement
nikunjsoni

334

Jun 28th, 2021
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. class Solution {
  2. public:
  3.     bool increasingTriplet(vector<int>& nums) {
  4.         int first=INT_MAX, second=INT_MAX;
  5.         for(auto num: nums){
  6.             if(num<=first)
  7.                 first = num;
  8.             else if(num<=second)
  9.                 second = num;
  10.             else
  11.                 return true;
  12.         }
  13.         return false;
  14.     }
  15. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement