C++ Recursive Solution but got TLE
int countSubseq(int index,int n,int sum,int target,vector &nums,vector&subseq){\n        if(index == n){\n            if(!subseq.empty()){\n                int 
int countSubseq(int index,int n,int sum,int target,vector<int> &nums,vector<int>&subseq){\n        if(index == n){\n            if(!subseq.empty()){\n                int minEle = *min_element(subseq.begin() , subseq.end());\n                int maxEle = *max_element(subseq.begin() , subseq.end());\n                if(maxEle+minEle <= target) return 1;\n            }\n            return 0;\n        }\n        subseq.push_back(nums[index]);\n        sum += nums[index];\n        int leftSum = countSubseq(index+1,n,sum,target,nums,subseq);\n        subseq.pop_back();\n        sum -= nums[index];\n        int rightSum = countSubseq(index+1,n,sum,target,nums,subseq);\n        return leftSum+rightSum;\n    }
['Recursion', 'C']