Smarsh's message-processing workflows can represent a sequence of event value changes as an integer array. Given nums and an integer k, return all contiguous subarrays whose elements sum exactly to k.
Return each match as a two-element list [start, end], using zero-based inclusive indices. List matches in increasing end index order. For matches ending at the same index, list them in increasing start index order. If no subarray matches, return an empty list.
Values may be positive, zero, or negative, so a sliding-window approach is not generally valid.
Implement find_subarrays(nums, k):
nums, a list of integers, and k, an integer.[start, end] index pairs for every contiguous subarray whose sum equals k.def find_subarrays(nums, k):