Search for a command to run...
A house has N rooms numbered 1 to N. Each room contains a specific number of gold coins.
Given a target value K, find a continuous sequence of rooms where the total sum of gold coins is exactly equal to K.
If multiple such sequences exist, return the one that starts with the smallest room number.
Input: N = 10 K = 15
Coins: 5 3 7 14 18 1 18 4 8 3
Output: 1 3
Explanation:
The sum of coins in rooms 1 to 3 → 5 + 3 + 7 = 15
The sum of coins in rooms 8 to 10 → 4 + 8 + 3 = 15
Both sequences give the required sum, but room 1 is smaller than room 8, so the answer is 1 3.
Example 1
10, 15, [5, 3, 7, 14, 18, 1, 18, 4, 8, 3][1, 3]Example 2
5, 10, [1, 2, 3, 4, 5][1, 4]10, 15, [5, 3, 7, 14, 18, 1, 18, 4, 8, 3]
[1, 3]