Atos service-monitoring pipelines process arrays of signed event deltas. Given an integer array and a target sum, return the start and end indices of the longest contiguous subarray whose elements add up to the target.
If multiple longest subarrays exist, return the one with the smallest start index. Return [] if no qualifying subarray exists.
Implement longest_subarray_sum(nums, target).
nums, a list of integers, and target, an integer.[start, end] containing inclusive zero-based indices, or [] when no solution exists.The array may contain negative numbers, zeroes, and positive numbers, so a sliding-window approach is not generally valid.
def longest_subarray_sum(nums, target):