2_Pointor.py
Approach\nTwo Pointer\n\n# Complexity\n- Time complexity:\n O(n)\n\n\n# Code\n\nclass Solution:\n    def numSubseq(self, nums: List[int], target: int) -> int:\n
# Approach\nTwo Pointer\n\n# Complexity\n- Time complexity:\n $$O(n)$$\n\n\n# Code\n```\nclass Solution:\n    def numSubseq(self, nums: List[int], target: int) -> int:\n        nums.sort()\n        ans=0\n        i,j=0,len(nums)-1\n        while i<=j:\n            if nums[i]+nums[j]>target:\n                j-=1\n            else:\n                ans+=2**(j-i)\n                ans=ans%(10**9+7)\n                i+=1\n        return ans%(10**9+7)\n```
['Python3']