Apple | Phone | Longest Subarray Sum At Most K

Anonymous User
10190
Jul 27, 2020
Oct 31, 2020

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)?

Comments (13)