Find the maximum length of a subarray that sums to k
Answers
Answered by
0
Answer:
Longest Subarray having sum of elements atmost 'k' Traverse the array and check if on adding the current element its sum is less than or equal to k. If it's less than k then add it to sum and increase the count. Else. Remove the first element of subarray and decrease the count. Keep track of Maximum count.
Answered by
0
Answer:
It is used to find the length of a sub array that is the suk of the K.
Similar questions