Find Maximum Length

Asked at Uber · Coding & Leetcode-style Questions · Difficulty: Medium

You are given an array of \(n\) magical fruits. The power of the fruit is given in an array of length \(n\). You are also given an integer \(k\). Your task is to find the maximum length \(L\) such that every subarray of length \(L\) has the sum of powers strictly less than \(k\).

Loading the problem…