[CareerCup] 2. Bomberman 炸弹人
Posted 轻风舞动
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[CareerCup] 2. Bomberman 炸弹人相关的知识,希望对你有一定的参考价值。
We have a 2D grid. Each cell is either a wall, an enemy or empty.
For example (0-empty, X-enemy, Y-wall):
0 X 0 0
X 0 Y X
0 X 0 0
You have one bomb and you want to kill as many as possible enemies with it. The bomb will kill all the enemies in the same row and column from the planted point until it hits the wall since the wall is too strong to be destroyed.
Given such a grid, return the maximum enemies you can kill with one bomb.
Note that you can only put the bomb at empty cell.
In the example, if you put a bomb at (1,1) you will kill 3 enemies which is the best you can get. You can not kill the guy behind the wall at (1,3).
这个题实质是LeetCode上的 361. Bomb Enemy
CareerCup Questions List 职业杯题目列表
以上是关于[CareerCup] 2. Bomberman 炸弹人的主要内容,如果未能解决你的问题,请参考以下文章
[CareerCup] 15.1 Renting Apartment 租房
[CareerCup] 15.2 Renting Apartment II 租房之二
CareerCup Questions List 职业杯题目列表