Search
⌘K
Get Premium
Leetcode 1498. Number of Subsequences That Satisfy the Given Sum Condition
Count the number of non-empty subsequences whose minimum plus maximum is ≤ target (answer mod 1e9+7). With n up to 1e5, the usual efficient approach is to sort and use two pointers plus combinatorics (precomputed powers of two) to count valid subsets without enumerating them.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.