# Ruby Interview with an Amazon engineer

### Interview Summary

**Problem type**  
Minimum tree depth  
**Interview question**  
Given an unbalanced BST, determine the minimum depth of all of its leaves.

### Interview Feedback

**Feedback about Wily Sandwich (the interviewee)**  
**Advance this person to the next round?**  
Yes  
**How were their technical skills?**  
3/4  
**How was their problem solving ability?**  
3/4  
**What about their communication ability?**  
4/4

> Good job solving the problem today, and a good discussion of the approaches (dfs vs bfs), and proceeded with implementing the optimal solution. With that, I rate this interview as a pass. For reference, here is the question we discussed today:  
> [Minimum Depth of Binary Tree](https://leetcode.com/problems/minimum-depth-of-binary-tree/)  
> We discussed the feedback at the end of the interview, and below is a brief summary:  
> - good job brainstorming various approaches and explaining the reasoning for BFS to be the better approach  
> - great job explaining your thought process as you code, which allows the interviewer to follow your thought process throughout  
> - good job implementing the algorithm within the allotted time  
> - coding speed can be a bit quicker so that you have time to run some tests and provide complexity analysis

**Feedback about Hot Gyro (the interviewer)**  
**Would you want to work with this person?**  
Yes  
**How excited would you be to work with them?**  
3/4  
**How good were the questions?**  
3/4  
**How helpful was your interviewer in guiding you to the solution(s)?**  
3/4

> I think that there were moments where I was struggling where they felt like I could get to the answer, which was good. I'm glad I had recently revisited BFS and that that was helpful in me coming to a solution in this case.

### Interview Transcript

**Hot Gyro:** Hello.  
**Wily Sandwich:** Hi there.  
**Hot Gyro:** Hi. Can you hear me?  
**Wily Sandwich:** Yeah. Can you hear me?  
**Hot Gyro:** Okay, great. Well, let's get started. We have an hour for our coding interview, is that correct?  
**Wily Sandwich:** Yeah, I think so.  
**Hot Gyro:** So I've got a couple of questions prepared. So let's get started. When you finish, we can just keep going. So let's start with the first question. Can you pick the language that you will be using for this problem?  
**Wily Sandwich:** Sure. That would be Ruby here.

> [Watch Ruby Interview with an Amazon engineer: Minimum Tree Depth](https://www.youtube.com/watch?v=qeJosUVwgjk)

**Interview Problem Discussion**  
- **Goal:** Find the minimum depth of a binary tree (BST).
- **Approach:** Use Depth First Search (DFS) or Breadth First Search (BFS).
- **Solution Insights:** 
  - Discussed advantages of BFS in finding the shortest path quickly, especially in unbalanced trees.
  - Implementation discussions around recursive methods vs iterative with queues.

### Key Points of the Discussion
  
- Defined the problem through an example and reasoned through the approach based on tree structure.  
- Addressed the need for efficiency in coding, complexity analysis, and managing time during the interview.
- Highlighted the importance of articulating thought processes clearly for the interviewer.

### Conclusion
- Interviewee exhibited strong problem-solving abilities and communication skills.
- Key areas for improvement included coding speed and time management during interviews.
