摘要: 问题: 给定国际象棋二维数组, B代表阻止,p代表可吃点,R代表起始点。 从R开始向上下左右直线移动,遇到p点,res+1。遇到B或者棋盘边界res不增不减。 求最后res的值。 Example 1: Input: [[".",".",".",".",".",".",".","."],[".",". 阅读全文
posted @ 2020-06-03 14:09 habibah_chang 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定两个数组A,B 若两个数组存在相同的数,则画一条连线,使得所画连线不得相交,最多能画多少条? Example 1: Input: A = [1,4,2], B = [1,2,4] Output: 2 Explanation: We can draw 2 uncrossed lines a 阅读全文
posted @ 2020-06-03 13:24 habibah_chang 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定数组,求两个固定长度M和L的子数组(不相交)之和最大为多少 Example 1: Input: A = [0,6,5,2,2,5,1,9,4], L = 1, M = 2 Output: 20 Explanation: One choice of subarrays is [9] wit 阅读全文
posted @ 2020-06-03 10:43 habibah_chang 阅读(111) 评论(0) 推荐(0) 编辑