Question bank › Arrays
Dsa Arrays Medium

Longest Non-Decreasing Subarray

Given an array of integers, find the length of the longest non-decreasing subarray. A non-decreasing subarray is defined as a contiguous segment where each element is less than or equal to the next. Input Format: - The first line contains an integer n (1 <= n <= 1000), the number of elements in the array. - The second line contains n integers separated by spaces, representing the elements of the array. Output Format: - Output a single integer, the length of the longest non-decreasing subarray. Example Input: 6 1 2 2 3 1 5 Example Output: 3

Key concepts

arrayssubarraysiteration

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.