Hi guys,
I had my Google onsite 1 today, and it started off horribly — the interviewer's link wasn’t opening, which wasted a precious 10 minutes right at the beginning.
I was given the following problem based on the game Go:
In Go, two players place stones on an n x n grid. One player is black (B), and the other is white (W).
- Stones of the same color placed adjacent to each other are called blocks.
- Any blank space adjacent to a block of stones is called a liberty of the block.
- Any block without liberties is captured.
Given a board represented by a 2D array of characters and coordinates representing a stone position, determine if the stone is part of a captured block.
(0,0) is the top-left corner.
|B|W|W|B|O|
|B|W|W|B|O|
|B|W|W|B|O|
|B|W|W|B|O|
|O|O|O|B|O| (1,1) → false
|W|W|W|B|O|
|B|W|W|B|O|
|B|W|W|B|O|
|B|B|B|B|O|
|O|O|O|B|O| (1,1) → true
I proposed a DFS-based solution. The interviewer seemed happy with my approach. However, by the time I finished solving the main problem, I only had 2 minutes left.
Since there wasn’t enough time to code the follow-up, the interviewer suggested we just discuss it. I proposed a possible solution, and he confirmed that it was a valid approach.
I'm feeling a bit doubtful about the result. Since the interview lasted less than 45 minutes due to the initial technical issues, I'm not sure if it would count as a Lean Hire or something worse.
Has anyone experienced something similar? 🤔