Coding

How would you write a function that calculates the number of mines adjacent to each cell in a minesweeper board?

Machine Learning EngineerData Scientist

Flexport

Roblox

AT&T

Boeing

Bolt

Gusto

Did you come across this question in an interview?

  • How would you write a function that calculates the number of mines adjacent to each cell in a minesweeper board?
  • Can you devise a method to transform a character array from a minesweeper grid into an integer array of adjacent mine counts?
  • What's your strategy for generating an array that shows the count of mines surrounding each spot on a minesweeper map?
  • How do you plan to convert a minesweeper's array of mines into an array reflecting the count of neighboring mines?
  • What would be your approach to count the adjacent mines for each cell in a minesweeper board represented by a character array?
  • Could you demonstrate how to process a minesweeper board array and output the mine counts for each cell?
  • How can you map a character array indicating mines to an integer array that counts adjacent mines in minesweeper?
  • What logic would you use to construct an array showing the number of surrounding mines on a minesweeper board?
  • Can you create an algorithm to convert a minesweeper character grid into an array of numbers denoting adjacent mines?
  • Given an array of characters representing mines on a minesweeper board, return an array of integers representing the number of mines around each cell.

Interview question asked to Data Scientists and Machine Learning Engineers interviewing at AT&T, Grubhub, Niantic and others: How would you write a function that calculates the number of mines adjacent to each cell in a minesweeper board?.