码迷,mamicode.com
首页 > 其他好文 > 详细

[CareerCup] 2. Bomberman 炸弹人

时间:2018-03-02 10:24:33      阅读:185      评论:0      收藏:0      [点我收藏+]

标签:gpo   careercup   you   with   logs   col   div   return   cup   

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] 2. Bomberman 炸弹人

标签:gpo   careercup   you   with   logs   col   div   return   cup   

原文地址:https://www.cnblogs.com/lightwindy/p/8491305.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!