Short and Easy C++ solution
Intuition\nTwo Pointer and sorting\n Describe your first thoughts on how to solve this problem. \n\n# Approach\nAs we are interested in subsequences, we can sor
# Intuition\nTwo Pointer and sorting\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\nAs we are interested in subsequences, we can sort the array,\nNow then we intialise two pointer at both end and find the potential min and max range and then we consider the min element as fix for current subsequence and count total number of subsequence by bin() fun. for current min value and add this for potential candidate in nums.\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(nlog(n) + n), nlogn -> sorting, n->two pointer\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n#define ll long long\nclass Solution {\npublic:\n    ll inf = 1e9+7;\n    ll bin(ll a, ll b)\n    {\n        ll ans = 1;\n        while(b)\n        {\n            if(b&1) ans = (ans * a)%inf;\n            a = (a * a)%inf;\n            b >>= 1;\n        }\n        return ans;\n    }\n    \n    int numSubseq(vector<int>& nums, int target) {\n        sort(nums.begin(), nums.end());\n        int  n = size(nums),i = 0, ans = 0, j= n-1;\n        while(i<=j)\n        {\n            if(nums[i] + nums[j] > target)--j;\n            else ans = (ans + bin(2, j-i)) %inf, ++i;\n        }\n        return ans;\n    }\n};\n// Upvote if you like the solution!!! \uD83D\uDC4D\uD83D\uDC4D\n```
['C++']