Code + Login Explanation | Python
\nThe solution to the question lies in finding the number of possible subsequence between \nstart and end pointer.\n\nLet the first pointer be at index 0 and  l
```\nThe solution to the question lies in finding the number of possible subsequence between \nstart and end pointer.\n```\nLet the first pointer be at index ```0``` and  last pointer be at index ```n-1```.\n\nSteps to follow:\n1. Sort the array\n2. Find the ```start and end ```index such that ```A[start] + A[end]  <= target``` \n3. Let\'s say we have the required start index ```i``` and end index ```j```.  \n\ta. For all the index starting from ```i+1``` to ```j```, we can choose either include it our set or ignore it\n\tb. Meaning for every index from ```i+1``` to ```j``` we have two options\n\tc. Therefore the total count of subsets would be ```2**(j-i)```\n\t\n\t\n```\nclass Solution:\n    def numSubseq(self, nums: List[int], target: int) -> int:\n        \n        left = 0\n        right = len(nums)-1\n        nums.sort()\n        ans = 0\n        while left <= right:\n            val = nums[left] + nums[right]\n            if val > target:\n                right-=1\n            else:\n                ans += pow(2,right-left,10**9+7)\n                left+=1\n        return ans % (10**9 + 7)\n\t\t\n\t\n\tUpvote if this helps !\n\t\n
['Python']