Generate 2D Minesweeper Grid

Problem overview from a real Uber interview:

Build a minesweeper board. Given the grid dimensions rows and cols and a mine count n, place n mines on distinct random cells of a rows x cols grid and print (or return) the resulting 2D array.

Check more interview questions and experiences about Uber

Please log in to view interview details