Using backtrack template

bool dfs334(vector<int>& nums, int b, vector<int> tmp){ if(tmp.size()==3) return true; for(int i=b;i<nums.size();i++){ if(tmp.empty()||nums[i]>tmp.back()){ tmp.push_back(nums[i]); if(dfs334(nums,i+1,tmp)) return true; tmp.pop_back(); } } return false; } bool increasingTriplet(vector<int>& nums) { // 334 return dfs334(nums, 0, vector<int>()); }Increasing Triplet Subsequence