Your question is Longest Contiguous Subarray Sum Equals 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.
Facebook News Feed analytics may represent each interaction as an integer score, including positive, negative, and zero values. Given an integer array nums and an integer k, return the length of the longest contiguous subarray whose elements sum exactly to k.
You must consider every contiguous subarray and may return 0 if no qualifying subarray exists.
nums, a list of integers, and k, an integer.k.def longest_subarray_sum_k(nums, k):