Easy beginner friendly sollution
\n# Approach\nmodified 2 sum approach\n\n# Complexity\n- Time complexity:\nO(nlogn)\n\n- Space complexity:\nO(1)\n\n# Code\n\nclass Solution {\npublic:\n    int
\n# Approach\nmodified 2 sum approach\n\n# Complexity\n- Time complexity:\nO(nlogn)\n\n- Space complexity:\nO(1)\n\n# Code\n```\nclass Solution {\npublic:\n    int mod=1e9+7;\n    long power(int x,int y){\n        if(y==0)return 1; \n        if(y==1) return x;\n        long ans=1;\n        if(y%2==0){\n            ans=power(x,y/2);\n            ans*=ans;\n        }else{\n             ans=power(x,y-1);\n            ans*=x;\n        }\n        return ans%mod;\n    }\n    int numSubseq(vector<int>& nums, int target) {\n        sort(nums.begin(),nums.end());\n        int s=0,e=nums.size()-1;\n        int ans=0;\n        while(s<=e){\n            if(nums[s]+nums[e]<=target){\n              ans+=power(2,e-s);\n              ans%=mod;\n              s++;\n            }else{\n              e--;\n            }\n        }\n        return ans;\n    }\n};\n```
['C++']