CPP SOLUTION PROMINENT
\n\n\n# Code\n\nclass Solution {\npublic:\n    int numSubseq(vector<int>& nums, int target) {\n        sort(nums.begin(),nums.end());\n        int mod = 1e9+7;\
![UPvote.jpg](https://assets.leetcode.com/users/images/73fbe10e-8810-4275-a006-4eceb82307fb_1683401010.6476388.jpeg)\n\n\n# Code\n```\nclass Solution {\npublic:\n    int numSubseq(vector<int>& nums, int target) {\n        sort(nums.begin(),nums.end());\n        int mod = 1e9+7;\n        int i = 0;\n        int j  = nums.size()-1;\n        int ans=0;\n        vector<int>subs(nums.size(),0);\n        subs[0] = 1;\n        for(int i=1;i<nums.size();i++){\n            subs[i] = (subs[i-1]*2)%mod;\n        }\n        while(i<=j){\n            if(nums[i]+nums[j]>target)j--;\n            else{\n                ans = (ans + subs[j-i])%mod;\n                i++;\n            }\n        }\n        return ans;\n    }\n};\n```
['C++']