Your question is Largest Subarray With Sum k. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
A Citadel Securities analytics component receives a sequence of signed integer values, such as normalized market-data changes. Given an integer array nums and target k, return the length of the longest non-empty contiguous subarray whose elements sum exactly to k.
Return 0 if no such subarray exists.
nums, an array of integers, and k, an integer target.k.def max_subarray_length(nums, k):