# Python Interview with an Apple engineer

#### Watch someone solve the longest increasing path problem in an interview with an Apple engineer and see the feedback their interviewer left them. Explore this problem and others in our library of interview replays.

Longest increasing path (Python Interview) - YouTube

[Longest increasing path (Python Interview)](https://www.youtube.com/watch?v=3QA4Yg4leGQ)

### Interview Summary

**Problem type**  
Longest increasing path

**Interview question**
1) Given an integer array nums and two integers left and right, return the number of contiguous non-empty subarrays such that the value of the maximum array element in that subarray is in the range [left, right].

2) Given an m x n integers matrix, return the length of the longest increasing path in matrix.

Read more about the questions
- [Longest Increasing Path in a Matrix](/content/questions/longest-increasing-path-in-a-matrix/index.html)

### Interview Feedback

**Feedback about Swift Pigeon (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?  
3/4

> Summary feedback: The candidate showed very good problem-solving skills. He was able to come up with the best possible approach pretty quickly. Before starting to dig into the most optimal approach, he came up with a brute-force approach and was able to correctly estimate the time and space complexity. Overall the candidate led the interview, communicated pretty efficiently, and kept me on the same page. He rushed a bit early into coding, and therefore the coding phase took a bit longer than it could have taken. But nevertheless, he solved the problem with the best possible way in terms of the time and space complexity.
>
> As we discussed, please practice Graph Theory, DP, and Graph Theory + DP problems. Based on the second problem we had, it looks like Graph Theory + DP is one of your weak spots.

**Feedback about Mutable Alligator (the interviewer)**  
Would you want to work with this person?  
Yes

How excited would you be to work with them?  
4/4

How good were the questions?  
4/4

How helpful was your interviewer in guiding you to the solution(s)?  
4/4

> Very helpful session!

### Interview Transcript

**Mutable Alligator**: Hello. Hi can you hear me.  
**Swift Pigeon**: Yes I can, can you hear me?  
**Mutable Alligator**: Alright, yeah, I can hear you. How are you?  
**Swift Pigeon**: I'm doing okay, thank you. And you?  
**Mutable Alligator**: Good. Thank you. So we are going to have an algorithms data structure interview session that is going to last for 40-45 minutes. So before we start with this, tell me about your experience and about your goals.  
**Swift Pigeon**: Yeah. I am a recent graduate. I just started working a few months ago. And I am looking to switch jobs. So I'm going to start interviewing by the end of this year. And yeah, I currently, you know, just a few months on the job, front end, software engineers. So just looking to get some practice.  
**Mutable Alligator**: Okay, sounds good. Do you have any plans in terms of like, what companies you're applying for?  
**Swift Pigeon**: Yeah. FAANG companies and, you know, other top companies, I guess.  
**Mutable Alligator**: And what position? Okay. Okay. You said the new grad, new grad, okay. So it's probably going to be something like entry-level position.  
**Swift Pigeon**: Yes.

**Mutable Alligator**: Okay, in this case, I think I'm going to just ask you a regular question that I usually ask on a real interview. Yeah. So let's try to solve this.

**Swift Pigeon**: Okay, given an integer array, and two integers left and right. Okay. Return the number of contiguous non-empty subarrays such that the value of the max is in the range of left to right. Left and Right. And we're saying return I'm just going to highlight the return number non-empty subarray then the max array element in that subarray is in the range left to right. Right, I think those are the two main points. So the left and right is that inclusive of the right? Correct and left, okay. And then this example right? The max is in the range two, three. Okay. Do we have negative numbers in the array?

**Mutable Alligator**: Yeah, there can be negatives.  
**Swift Pigeon**: Okay. And what's the maximum number I can have?  
**Mutable Alligator**: I think we can basically think about some solutions before we jump into basically becoming something that there's nothing special about these numbers.

**Swift Pigeon**: Okay. Alright, if we think about the number of subarrays in that range, okay.

...

**Swift Pigeon**: ...Okay, so basically, yeah, I think that what you're, you're going to have is like, a repeat one more time. How are we going to calculate this? Number of subarrays? I think the range. I say you're going to iterate through this array with these parameters, basically, minus infinity and left minus one, right? Yeah. Okay. And got it. Yeah, I think that sounds good to me.

**Swift Pigeon**: Thank you. Thank you.
