Longest Subarray
Problem Overview
- Determine the length of the longest contiguous subarray whose sum is less than or equal to k.
- Input: integer array a and integer k; Output: a single integer length.
- Constraints: 1 ≤ n ≤ 1e5, 1 ≤ a[i] ≤ 1e3, 1 ≤ k ≤ 1e9.
- Context: array sum analysis applicable to data processing and performance-sensitive tasks.
- Source: asked in Goldman interviews; a classic coding interview problem and interview question.
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Input Variables
Execution Result:
