Skip to content

Commit 295f4d8

Browse files
Added solution
1 parent e5cde65 commit 295f4d8

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

increasing_triplet_subsequence.cpp

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
class Solution {
2+
public:
3+
bool increasingTriplet(vector<int>& nums) {
4+
5+
int min_ = INT_MAX, nmin_ = INT_MAX;
6+
7+
for(auto num : nums){
8+
min_ = min(min_, num);
9+
if(num > min_)
10+
nmin_ = min(nmin_, num);
11+
if(num > nmin_)
12+
return true;
13+
}
14+
return false;
15+
}
16+
};

0 commit comments

Comments
 (0)