Untitled
unknown
plain_text
a year ago
410 B
3
Indexable
class Solution { public: bool increasingTriplet(vector<int>& arr) { int first=INT_MAX,second=INT_MAX; for(int i=0;i<arr.size();i++){ if(arr[i]<=first) first=arr[i]; else if(arr[i]<=second) second=arr[i]; else return true;//if we reach this that means arr[i] is >than both first and scond and thus we have a answer } return false; } };
Editor is loading...
Leave a Comment