Meta PE Intern Screening
Anonymous User
76

Questions asked
Minesweeper

  1. Implement code that places mines randomly in a m * n grid
    First suggested a brute force method, simple for loop, break when count exceeds number of mines that needs to be placed.
  2. How can you do this randomly
    Mentioned I can use random int and get a number between 0 and m * n - 1, in a while loop, break once count exceeds the number of mines - here I missed the edge case what happens if the randomly generated number is same, interviewer asked the same and I modified the code, couple of times I mistyped variables that was also pointed out.
  3. Can you extend the code to calculate number of mines present in adjacent blocks (including the ones in diagonal blocks)
    Told I can use DFS to recursively check for mines and the interviewer asked to code the same. I had less time, coded as much as possible, missed adding the dfs call for diagonal positions (i+1, j+1, i-1, j-1), interviewer gave the hint and I added a couple and interviewer told again that I am still missing couple of them, I realised and added them (i+1, j-1, i-1, j+1) . Ran out of time by then interviewer okay said its close to correct and asked me if I have any questions.

What are the chances of getting to the next round? I was feeling good after the interview because I could come up with solutions without any hint, although I havent really seen this question before. But its been a week, no response yet, so I am worried.

Comments (0)