LeetCode --- 999. Available Captures for Rook 解题报告
Posted 杨鑫newlfe
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LeetCode --- 999. Available Captures for Rook 解题报告相关的知识,希望对你有一定的参考价值。
On an 8 x 8
chessboard, there is exactly one white rook \'R\'
and some number of white bishops \'B\'
, black pawns \'p\'
, and empty squares \'.\'
.
When the rook moves, it chooses one of four cardinal directions (north, east, south, or west), then moves in that direction until it chooses to stop, reaches the edge of the board, captures a black pawn, or is blocked by a white bishop. A rook is considered attacking a pawn if the rook can capture the pawn on the rook\'s turn. The number of available captures for the white rook is the number of pawns that the rook is attacking.
Return the number of available captures for the white rook.
Example 1:
以上是关于LeetCode --- 999. Available Captures for Rook 解题报告的主要内容,如果未能解决你的问题,请参考以下文章
leetcode999. Available Captures for Rook
LeetCode --- 999. Available Captures for Rook 解题报告
LeetCode --- 999. Available Captures for Rook 解题报告
Leetcode 999. Available Captures for Rook