Available question text
Given two length-n arrays, choose for each index either nums1[i] or nums2[i] to form nums3 so as to maximize the length of a contiguous non-decreasing subarray in nums3. With n up to 1e5, the problem is solved in O(n) by scanning and maintaining the longest non-decreasing subarray ending at each index for the two possible choices.
Related questions
Continue with questions that share topics or the same question type.
- Choose Numbers From Two Arrays in Range
Coding
- Count Non Decreasing Arrays With Given Digit Sums
Coding · Array · Dynamic Programming · Prefix Sum
- Create Object from Two Arrays
Coding
- Find Longest Non-Decreasing Contiguous Sequence with One Substitution
Coding
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 2771. Longest Non-decreasing Subarray From Two Arrays
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source