```
class Solution {
public:
bool increasingTriplet(vector<int>& nums) {
int n= nums.size();
if(n<3) return false;
int arr[3], len=0;
arr[0] = nums[0];
for(int i=1; i<n; i++){
if(nums[i] <= arr[0])
arr[0] = nums[i];
else if(nums[i] > arr[len])
arr[++len] = nums[i];
else if(nums[i] != arr[len] && nums[i]> arr[len-1])
arr[len] = nums[i];
if(len ==2)
return true;
}
return false;
}
};
```