class Solution {
public:
bool increasingTriplet(vector<int>& nums) {
int prev2 = INT_MAX;//min
int prev1 = INT_MAX;
for (auto &v : nums) {
if (v <= prev2)
prev2 = v;
else if (v <= prev1)
prev1 = v;
else
return true;
}
}
};
reference:
https://leetcode.com/discuss/86593/clean-and-short-with-comments-c
http://yzmduncan.iteye.com/blog/1546503