Problem · Matrix

Minimum Obstacle Removal

MediumUberFULLTIMEOA
See Uber hiring insights

You are given a 2d matrix which consist of the following symbols ".", "#", "|", where "." represent free cell, "#" represent a obstacle, "|" denotes shape. Your task is to find out the minimum obstacle to remove from the matrix so that the shapes falls down to the bottom.

Examples
01 · Example 1
matrix = [["*", "*", "*", "*"], ["#", "*", ".", "*"], [".", ".", "#", "."], [".", "#", ".", "#"]]
return = 4
Example 1 illustration
Hence, return 4.
More Uber problems
drafts saved locally
public int minimumObstacleRemoval(String[][] matrix) {
  // write your code here
}
matrix[["*", "*", "*", "*"], ["#", "*", ".", "*"], [".", ".", "#", "."], [".", "#", ".", "#"]]
expected4
sign in to submit