1/6
Loading...
💰Saving Allowance!
Let's find consecutive days where allowance sums to 10!
Loading...
Let's find consecutive days where allowance sums to 10!
You are given an array of daily allowance amounts. Find if there exists a contiguous subarray that sums exactly to the target amount. If found, return the start and end indices of that subarray.
allowance = [1, 4, 2, 3, 5, 1, 2], target = 10
[1, 3]
Index 2~4: 2+3+5 = 10! Answer is [2, 4]