Number of Subsequences That Satisfy the Given Sum Condition C++ Solution
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```\nclass Solution {\npublic:\n    int numSubseq(vector<int>& nums, int target) {\n         int n = nums.size();\n        int MOD = 1e9+7;\n        int ans = 0;\n        vector<int> power(n, 1);\n                for(int i = 1; i < n; ++i){\n            power[i] = (power[i-1] << 1) % MOD;\n        }\n        \n        sort(nums.begin(), nums.end());\n        \n        for(int l = 0, r = n-1; l <= r; ){\n            if(nums[l] + nums[r] > target)\n            {--r;\n            }else{\n                ans = (ans + power[r-l]) % MOD;\n                ++l;}\n        }\n        return ans; \n    }};\n```
['C++']