leetle

Daily challenge for 2026-02-20

416. Longest Subarray with Sum Limit

Given an array of positive integers nums and an integer k, find the length of the longest contiguous subarray such that the sum of its elements is less than or equal to k. If no such subarray exists, return 0.

Example:
Input: nums = [1, 2, 1, 0, 1], k = 4
Output: 5

Run this challenge interactively in Python or JavaScript when the app loads.