← ALL NOTES
Array

1498. Number of Subsequences That Satisfy the Given Sum Condition

Count non-empty subsequences whose min + max ≤ target, mod 1e9+7. Since only the min and max matter (order and middle elements are free), sort and use two pointers: for each fixed minimum, count how…

Loading…