cswork / OAOpen practice workspace

UberOA #52

Minimum Obstacle Removal

Estimated MediumStatement and editorial — judging is being prepared

Topics (AI-labelled)Grid SearchSimulation

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.

Constraints

N/A

Example 1

Input:

matrix = [["*", "*", "*", "*"], ["#", "*", ".", "*"], [".", ".", "#", "."], [".", "#", ".", "#"]]

Output:

4

Explanation: Hence, return 4.

Editorial

Loading solution…