Problem
Given a list of integers nums and an integer target, count the non-empty subsequences whose minimum plus maximum is at most `target`. A subsequence picks any set of positions (not necessarily next to each other). The count can be huge, so return it modulo `10^9 + 7`.
Example 1
- Input
- nums = [3, 5, 6, 7], target = 9
- Output
- 4
- Why
- [3], [3, 5], [3, 5, 6], [3, 6]
Example 2
- Input
- nums = [3, 3, 6, 8], target = 10
- Output
- 6
Example 3
- Input
- nums = [5], target = 9
- Output
- 0
- Why
- 5 + 5 = 10 is too big
Constraints
1 <= nums.length <= 10^51 <= nums[i] <= 10^61 <= target <= 10^6