leetcodeSolution to some Leetcode problems written in C++ |
git clone git://git.dimitrijedobrota.com/leetcode.git |
Log | Files | Refs | README | LICENSE |
0334.cpp (328B)
0 class Solution { 1 public: 2 bool increasingTriplet(vector<int> &nums) { 3 int a = INT_MAX, b = INT_MAX; 4 for (int x : nums) { 5 if (x <= a) 6 a = x; 7 else if (x <= b) 8 b = x; 9 else 10 return true; 11 } 12 return false; 13 } 14 };