Apple | Phone | Longest Subarray Sum At Most K
Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2020-07-27Added By Anonymous
Source: Link
This is actually the follow up question. Initially question is exactly LC - 862. Shortest Subarray with Sum at Least K.
Then the interviewer asked this other-way around follow-up:
Given an array of integers (contains both positive and negative numbers), find the longest subarray with sum at most k.
Is this doable in O(n)?