Java+two pointer approch
class Solution {\n    public int numSubseq(int[] nums, int target) {\n\n//basically the total subsequences possible from start to end is the ans of that particu
class Solution {\n    public int numSubseq(int[] nums, int target) {\n\n//basically the total subsequences possible from start to end is the ans of that particular start index\n    \n\tArrays.sort(nums);\n        int sp=0;\n        int ans=0;\n        int ep=nums.length-1;\n        while(sp<=ep){\n            if(nums[sp]+nums[ep]<=target){\n                ans+=help(2,ep-sp);//to calculate Math.pow(2,ep-sp) reduce to logn \n                ans=ans%1000000007;\n                sp++;\n            }else{\n                ep--;\n            }\n        }\n        return ans;\n    }\n    public long help(int x,int y){\n        if(y==1)\n            return x;\n        if(y==0)\n            return 1;\n        long ans=1;\n        if(y%2==0){\n            ans=help(x,y/2);\n            ans*=ans;\n        }else{\n            ans=help(x,y-1);\n            ans=ans*x;\n            ans=ans%1000000007;\n        }\n        return ans%1000000007;\n        \n    }\n}
[]