cswork / OA打开练习工作台

UberOA #52

Minimum Obstacle Removal

估计中等评测数据准备中,可先阅读题面

考点(AI 标注)网格搜索模拟/实现

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.