Do not use else,you will beat many people.


  • 1
    A
    class Solution
     {
    public:
        bool increasingTriplet(vector<int>& nums) 
        {
          int m1 = INT_MAX, m2 = INT_MAX;
          for (auto a : nums) 
          {
                 if (m1 >= a) {m1 = a;continue;}
                 if (m2 >= a) {m2 = a;continue;}
                 return true;
           }
           return false;
        }
    };

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.