package y2019.Algorithm.array; /** * @ProjectName: cutter-point * @Package: y2019.Algorithm.array * @ClassName: NumRookCaptures * @Author: xiaof * @Description: 999. Available Captures for Rook * * On an 8 x 8 chessboard, there is one white rook. The…
作者: 负雪明烛 id: fuxuemingzhu 个人博客:http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 四方向搜索 日期 题目地址:https://leetcode.com/problems/available-captures-for-rook/ 题目描述 On an 8 x 8 chessboard, there is one white rook. There also may be empty squares, white bishops, an…
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 暴力遍历 日期 题目地址:https://leetcode.com/problems/available-captures-for-rook/ 题目描述 On an 8 x 8 chessboard, there is one white rook. There also may be empty squares, white bishops, an…
题目如下: On an 8 x 8 chessboard, there is one white rook. There also may be empty squares, white bishops, and black pawns. These are given as characters 'R', '.', 'B', and 'p' respectively. Uppercase characters represent white pieces, and lowercase ch…
class Solution: def numRookCaptures(self, board: List[List[str]]) -> int: rook = [0, 0] ans = 0 for i in range(8): for j in range(8): if board[i][j] == 'R': rook[0], rook[1] = i, j for k in range(rook[1], 0, -1): # left if board[rook[0]][k] == 'p': a…
On an 8 x 8 chessboard, there is one white rook. There also may be empty squares, white bishops, and black pawns. These are given as characters 'R', '.', 'B', and 'p' respectively. Uppercase characters represent white pieces, and lowercase characte…