Subarray Sum Equals Target
This problem applies the prefix sum technique from the introduction: instead of testing every possible subarray, a running prefix sum turns the search into a hash table lookup.
Given an integer array arr and a target value, return a subarray whose sum equals the target. Return the answer as [start, end), where start is inclusive and end is exclusive. If there are multiple valid answers, return the one with the smaller end value.
Input: arr = [1, -20, -3, 30, 5, 4], target = 7
Output: [1, 4]
The subarray arr[1:4] = [-20, -3, 30] sums to 7.