Implement Minesweeper click and print
Nash AISoftware Engineer · Technical ScreenLast updated
Implement Minesweeper click and print evaluates algorithm design, data structures, correctness, complexity, edge cases, and implementation details in a realistic interview setting. A strong answer states assumptions, handles edge cases, explains trade-offs, and shows how to validate the result clearly.
Implement the Minesweeper click(row, col) operation and a function to print the board. Rules: (
- If the clicked cell is a mine, reveal it and indicate that the game is lost. (
- If the clicked cell has zero adjacent mines, recursively reveal all neighboring cells. (
- Otherwise, reveal the number of adjacent mines for that cell. Describe the data structures you will use to track states and neighbors, the traversal strategy (BFS or DFS) and how you prevent revisiting cells, and analyze time and space complexity.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.