Problem (in simple words)
- Xiao Kou wants to buy 1 staple food and 1 drink.
- Prices of staples are in array
staple
.
- Prices of drinks are in array
drinks
.
- Budget =
x
.
- Question: How many different (staple + drink) combos can he buy without going over budget?
- Because the answer can be very big, return it modulo 1,000,000,007.
Example 1
staple = [10, 20, 5]
drinks = [5, 5, 2]
x = 15
Valid pairs:
- 10 + 5 = 15 ✅
- 10 + 5 = 15 ✅
- 10 + 2 = 12 ✅
- 5 + 5 = 10 ✅
- 5 + 5 = 10 ✅
- 5 + 2 = 7 ✅
Answer = 6