Help Required !!! Longest subarray having sum greater than k
Anonymous User
1328

I am struggling with this question for quite long.

Problem statement:
Given an array of integers and a value k, find the length of largest subarray having a sum greater than k.
Example:
arr[] = {-2, 1, 6, -3}, k = 5
Output : 2
Largest subarray with sum greater than
5 is {1, 6}.

I have seen solution using binary search but I could not wrap my head around it?
Can you please help me with this binary search algorithm like how it works.
Expected time complexity:O(nlogn)

Comments (1)