```
class Solution {
public:
bool increasingTriplet(vector<int>& nums) {
int n = nums.size();
if (n < 3)
return false;
//maintain two number first ,second and make them meet the condition:first < second
//if we can find another number nums[i] and nums[i] > second,then return true
int first = INT_MAX;
int second = INT_MAX;
for (int i = 0; i < n; ++i)
{
if (first >= nums[i])
first = nums[i];
else if (second >= nums[i])
second = nums[i];
else
return true;
}
return false;
}
};
```