3738. Longest Non-Decreasing Subarray After Replacing at Most One Element
You are given an integer array nums. You are allowed to replace at most one element in the array with any other integer value of your choice. Return the length of the longest non-decreasing subarray that can be obtained after performing at most one replacement. An array is said to be non-decreasing if each element is greater than or equal to its previous one (if it exists). Example 1: Input
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start