Java Interview with a FAANG engineer.
Java Interview with a FAANG engineer
Interview Summary
Problem type: Shortest Path in Binary Matrix
Interview question: Given an n x n binary matrix grid, return the length of the shortest clear path in the matrix. If there is no clear path, return -1.
A clear path in a binary matrix is a path from the top-left cell (i.e., (0, 0)) to the bottom-right cell (i.e., (n - 1, n - 1)) such that:
- All the visited cells of the path are 0.
- All the adjacent cells of the path are 8-directionally connected (i.e., they share an edge or a corner).
- The length of a clear path is the number of visited cells of this path.
Example 1.
Input: grid =
[[0,0,0],
[1,1,0],
[1,1,0]]
Output: length = 4
Example 2.
Input: grid =
[[0,1,1,1],
[0,0,1,0],
[0,1,1,0],
[1,1,1,0]]
Output: -1
Interview Feedback
Feedback about Effulgent Covariate (the interviewee)
- Advance this person to the next round? No
- How were their technical skills? 3/4
- How was their problem-solving ability? 3/4
- What about their communication ability? 4/4
Thank you for another productive session. We focused on a DSA problem where there were several positive signals and some mixed. Recommendation for next session: After you've completed a majority of 3 or 4 first sections on Neetcode 150, let's focus a DSA round on one of those (could be 'mock' or 'mentorship').
Strengths:
- Communication
- Clarifying questions, e.g., getting buy-in for "directions" to explore neighbors.
- Affable and proactive in proposing next steps.
- Articulated overall strategy before starting to code.
- Problem solving
- Proposed BFS algorithm early on.
- Quick adoption of hints.
- Technical
- Comfortable with queues in Java.
Potential areas of improvement
- Recommend to verbalize a brute force solution first and state time and space for it.
- Time management: aim for ~4-5 minutes for clarifying questions/setup.
- Technical:
- Recommend to provide time/space complexity (worst case) near completion of most coding tasks.
Interview Transcript
Effulgent Covariate: Yeah. So mainly my focus has been working my way through the... Stochastic Panda: A bit of both would be great.
[Discussion about approaches for problem-solving]
Effulgent Covariate: I felt like if I got to the graphing section of the practice, I probably would have done a lot better on this.
Stochastic Panda: I stood out that your intuition for finding an algorithm is a lot better and faster.
Further suggestions
- Neetcode 150 first ~11 sections: Arrays to Graphs
- Recommend consistency in cadence for DSA: after completing 3 or 4 sections, a DSA round to solidify.