NVIDIA Interview Problem #1 — Check If Array Can Be Non-Decreasing

Given an array nums with n integers, your task is to check if it could become non-decreasing by modifying at most one element.
We define an array as non-decreasing if nums[i] <= nums[i+1] holds for every i (0-based) such that 0 <= i <= n-2.

English Summary (Approach)
Single pass. Count violations where nums[i] > nums[i+1]. If more than one ⇒ false. For the single violation at i, it’s fixable if either i==0 or nums[i-1] <= nums[i+1] (lower left), otherwise raise right to nums[i]. If fixable ⇒ true. Time O(n), space O(1).

The VOprep team has long accompanied candidates through various major company OAs and VOs, including NVIDIA , Google, Amazon, Citadel, SIG, providing real-time voice assistance, remote practice, and interview pacing reminders to help you stay smooth during critical moments. If you are preparing for Stripe or similar engineering-focused companies, you can check out our customized support plans—from coding interviews to system design, we offer full guidance to help you succeed.

END
 0