Non-Decreasing Array (Python)

We helped write the sequel to "Cracking the Coding Interview". Read 9 chapters for free →

Please read our definitive guide on Microsoft's hiring process and questions

Python Interview with a Microsoft engineer

Watch someone solve the non-decreasing array problem in an interview with a Microsoft engineer and see the feedback their interviewer left them. Explore this problem and others in our library of interview replays.

Non-decreasing Array (Python) - YouTube
Non-decreasing Array (Python)

Interview Summary

Problem type

Non-decreasing Array

Interview question

Given an array nums with n integers, your task is to check if it could become non-decreasing by modifying at most one element.

Interview Feedback

Feedback about Winter Penguin (the interviewee)

Advance this person to the next round?
Yes
How were their technical skills?
4/4
How was their problem solving ability?
3/4
What about their communication ability?
4/4

5 star on everything for L4, slight weaknesses for L5 but overall, great!
You're doing an amazing job, and Amazon would be lucky to have you. Goodluck in your interviews.

Interview Transcript

The Legendary Avenger: Hello.
Winter Penguin: Hello.
The Legendary Avenger: Hey can you hear me?
Winter Penguin: Yeah, I can
... Winter Penguin: Yeah, I think I have to import something for lists. I don’t remember what it is exactly. But yeah, I think this should probably work. If I were to go through a, let’s see if I can just make up some sort of case here.

...

The Legendary Avenger: All right, so a couple of things here. So just out of curiosity, when would you use binary search in a general sense? Like, when would you use it?
Winter Penguin: General sense when you're looking for something?

...

The Legendary Avenger: Great job overall.

Winter Penguin: Thank you for the feedback!

The Legendary Avenger: You're welcome! Let's wrap up here.