Problem Β· Array
Find Maximum Length of Non-Decreasing Subarray (Part 1)
Learn this problemProblem statement
Note π - It has a follow up question called Longest Non Decreasing Subarray Part 2 π¦
Given an array of size N, find the maximum length of non-decreasing subarray.
Function
findMaximumLengthOfNonDecreasingSubarray(arr: int[]) β intExamples
Example 1
arr = [0, 7, 3, 10, 2, 4, 6, 8, 0, 9, -20, 4]return = 4The maximum length of non-decreasing subarray is 4, which corresponds to the subarray [2, 4, 6, 8].
Constraints
1 <= arr.length <= 10^5-10^9 <= arr[i] <= 10^9
More Google problems
- Deduplicate Logs: Keep FirstONSITE INTERVIEW Β· Seen Jul 2026
- Deduplicate Logs: Keep LatestONSITE INTERVIEW Β· Seen Jul 2026
- Find a Template Across Binary-Tree LeavesONSITE INTERVIEW Β· Seen Jul 2026
- Maximum Programmer-Problem MatchingONSITE INTERVIEW Β· Seen Jul 2026
- Minimum Direction ViolationsONSITE INTERVIEW Β· Seen Jul 2026
- Stream Latest Log VersionsONSITE INTERVIEW Β· Seen Jul 2026
- Stream Unique Logs in Timestamp OrderONSITE INTERVIEW Β· Seen Jul 2026
- Top-K IP Addresses from File RecordsONSITE INTERVIEW Β· Seen Jul 2026