Even Odd Tree (C++)
C++ Interview with a Microsoft engineer
Watch someone solve the even odd tree problem in an interview with a Microsoft engineer and see the feedback their interviewer left them.
Interview Summary
Problem type
Even Odd Tree
Interview question
Given a tree, verify that on even levels, all values in the level are strictly increasing and even. On odd levels, verify all values in the level are strictly decreasing and odd.
Interview Feedback
Feedback about Sartorial Jaguar (the interviewee)
Advance this person to the next round?
No
How were their technical skills?
2/4
How was their problem solving ability?
3/4
What about their communication ability?
2/4
The problem I gave was Leetcode 1609: https://leetcode.com/problems/even-odd-tree/
- Explain thought process more before starting to code.
- Clarify constraints first before starting:
- can tree be empty
- can there be negative numbers
- can numbers be the same
- can numbers exceed C++ max/min int
- you said "copy paste"
- if you think you need to copy paste, maybe it is best to create a method but pass in the parameters that make it slightly different for example checkEvenOrOdd(List oneLevel, true)
- volunteer to run through a test case yourself, in a real interview if you say I'm done and don't run through a test case then that's your final answer and you don't get a chance to catch any mistakes
Learn BFS, DFS, check out "Cracking the Coding Interview"
Feedback about Mighty Hamburger (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
Honestly not much to say here, very helpful and personable. Was accommodating in the way that I wanted to practice C++ for the interview and even though he wasn't familiar with it, he did his best to follow and caught all my slip ups.
Interview Transcript
Mighty Hamburger: Hello.
Sartorial Jaguar: Hello, how are you?
Mighty Hamburger: Hey. I'm doing good. How are you?
Sartorial Jaguar: Great.
Mighty Hamburger: Great. So this is actually one of my first time interviewing someone. So I hope you cut me some slack here.
...
Sartorial Jaguar: Yeah. Yeah. So it's, that's the main part like you got to be study those algorithms for like BFS or DFS. And yeah, that's, that's pretty much it. Some other feedback? I guess. So I know, you you asked me while you were coding, oh, can the the numbers be negative? Oh, what is the maximum length? I think you should really do that at the beginning. Right? Because like, I personally think like, if you're just like jumping in, and then you realize this in the middle, that this time is easy, right? You can you can, you know, stick an absolute value on your if statement, and I can solve it, you can like change your millions, one, and that's fine. But if it's some other constraints, that is, like more complicated, it might change your entire code, and like what you wrote might not even be valid. So you really gotta gotta, you know, clarify those constraints early, before you jump into it.
Okay, so my question about that question is, so that is just knowledge I didn't have right knowledge I have not exercised. Yeah. And I be fulfilled, too. So this is that's the biggest fault of this whole interview. So that's what I have to work on. However, how I'm not like they could the question on the interview could not be recursion, how can I make sure that no matter what that question is like, do I just keep doing leetcode challenges?
(Subsequent conversation truncated for brevity)