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…
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…
题目如下: 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…
作者: 负雪明烛 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…
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…
请点击页面左上角 -> Fork me on Github 或直接访问本项目Github地址:LeetCode Solution by Swift 说明:题目中含有$符号则为付费题目. 如:[Swift]LeetCode156.二叉树的上下颠倒 $ Binary Tree Upside Down 请下拉滚动条查看最新 Weekly Contest!!! Swift LeetCode 目录 | Catalog 序 号 题名Title 难度 Difficulty 两数之…
Contest 121 (题号981-984)(2019年1月27日) 链接:https://leetcode.com/contest/weekly-contest-121 总结:2019年2月22日补充的报告.当时不想写.rank:1093/3924,AC:2/4.还是太慢了. [984]String Without AAA or BBB(第一题 4分)(Greedy, M) 给了两个数字,A 代表 A 个 ‘A’, B 代表 B 个‘B’ 在字符串里面.返回一个可行的字符串,字符串中包含 A…