✅C++ || Two-pointer || Set Theory || Sorting
\n\nT->O(n * log n) && S->O(n) [For storing the power of 2\'s in vector\n\n\tclass Solution {\n\tpublic:\n\t\tint numSubseq(vector& nums, int target) {\n\t\t\ti
![image](https://assets.leetcode.com/users/images/13685594-17ac-43f0-87ed-f56219b509d8_1657226273.2338908.png)\n\n**T->O(n * log n) && S->O(n) [For storing the power of 2\'s in vector**\n\n\tclass Solution {\n\tpublic:\n\t\tint numSubseq(vector<int>& nums, int target) {\n\t\t\tint mod=1e9+7,n=nums.size();\n\t\t\tsort(nums.begin(),nums.end());\n\t\t\tvector<int> p(n,1);\n\t\t\tfor(int i=1;i<n;i++) p[i]=(2*p[i-1])%mod;\n\t\t\tint i=0,j=n-1,count=0;\n\t\t\twhile(j>=i){\n\t\t\t\tif(nums[i]+nums[j]<=target){\n\t\t\t\t\tcount+=p[j-i];\n\t\t\t\t\ti++;\n\t\t\t\t}\n\t\t\t\telse j--;\n\t\t\t}\n\t\t\treturn count;   \n\t\t}\n\t};
['Two Pointers', 'C', 'C++']