Very Easy Way || Precomputing || sorting || Binary Search || CPP
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n#define mod 1000000007\nclass Solution {\npublic:\n    int numSubseq(vector<int>& nums, int target) {\n        int n=nums.size();\n        vector<int>v(n);\n        int p=1;\n        for(int i=0;i<n;i++){\n            v[i]=p;\n            p=2*p;\n            p=p%mod;\n        }\n        sort(nums.begin(),nums.end());\n        int ans=0;\n        for(int i=0;i<n;i++){\n            if(nums[i]+nums[i]>target){\n                break;\n            }\n            if(i==n-1){\n                ans++;\n                return ans;\n            }\n            \n            int s=i+1;\n            int e=n-1;\n            int m=(s+e)/2;\n            while(s<=e){\n                // cout<<s<<" "<<e<<" "<<i<<endl;\n                if(nums[m]<=target-nums[i]){\n                    s=m+1;\n                }\n                else if(nums[m]>target-nums[i]){\n                    e=m-1;\n                }\n                m=(s+e)/2;\n            }\n            int a=m-i;\n            ans=(ans%mod+(v[a]%mod))%mod;\n            // cout<<m<<endl;\n        }\n        return ans;\n    }\n};\n```
['Math', 'Binary Search', 'Sorting', 'C++']