-
알고리즘문제 3헬리'Daily/꾸준한 알고리즘 2023. 5. 29. 01:36728x90
function maxLength(a, k) { let start = 0; let sum = 0; let maxLen = 0; for(let end = 0; end < a.length; end++) { sum += a[end]; while(sum > k) { sum -= a[start]; start++; } maxLen = Math.max(maxLen, end - start + 1); } return maxLen; }
728x90