上一页 1 ··· 28 29 30 31 32 33 34 35 36 ··· 44 下一页
摘要: 问题: 以↘️对角线为轴,折叠反转数组 Example 1: Input: [[1,2,3],[4,5,6],[7,8,9]] Output: [[1,4,7],[2,5,8],[3,6,9]] Example 2: Input: [[1,2,3],[4,5,6]] Output: [[1,4],[ 阅读全文
posted @ 2020-05-17 14:31 habibah_chang 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定一个二维数组,求子数组之和为target的子数组个数。 Example 1: Input: matrix = [[0,1,0],[1,1,1],[0,1,0]], target = 0 Output: 4 Explanation: The four 1x1 submatrices tha 阅读全文
posted @ 2020-05-17 14:06 habibah_chang 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定一个行程长度编码序列A,即偶数为代表下一位数的个数。 如A=[3,8,0,9,2,5],是序列【88855】的编码。 next(n)函数返回,对被编码序列消化n个数后最后消化的数值。实现初始化函数RLEIterator和next函数。 Example 1: Input: ["RLEIte 阅读全文
posted @ 2020-05-17 10:50 habibah_chang 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定0,1组成的数组,0代表空位,1代表有人坐,求使得坐在,跟最近坐的人距离最远,这个距离是多少。 Example 1: Input: [1,0,0,0,1,0,1] Output: 2 Explanation: If Alex sits in the second open seat (s 阅读全文
posted @ 2020-05-16 16:35 habibah_chang 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定数组,求所有子数组的最大值最小值之差的总和是多少。 这个数若太大了,对其进行取kMod=10^9+7的模 Example 1: Input: [2,1,3] Output: 6 Explanation: Subsequences are [1], [2], [3], [2,1], [2, 阅读全文
posted @ 2020-05-16 15:32 habibah_chang 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定一个递增数组,求其中所包含的斐波那契数列的长度。 A[i]+A[i+1]=A[i+2] Example 1: Input: [1,2,3,4,5,6,7,8] Output: 5 Explanation: The longest subsequence that is fibonacci 阅读全文
posted @ 2020-05-16 13:17 habibah_chang 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定两个size相同的数组A,B 对A进行排列,使得同位 i 上对数,A[i]>B[i],求使得满足这样条件元素最多的A的排列。 Example 1: Input: A = [2,7,11,15], B = [1,10,4,11] Output: [2,11,7,15] Example 2: 阅读全文
posted @ 2020-05-14 16:56 habibah_chang 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定数组,判断其中含有多少个3阶幻方 Example 1: Input: [[4,3,8,4], [9,5,1,9], [2,7,6,2]] Output: 1 Explanation: The following subgrid is a 3 x 3 magic square: 438 9 阅读全文
posted @ 2020-05-13 14:06 habibah_chang 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定两个大小相同,由0和1构成的N*N矩阵。求将其中一个矩阵进行水平垂直平移,最终两个矩阵重叠(1)的最大面积为多少。 Example 1: Input: A = [[1,1,0], [0,1,0], [0,1,0]] B = [[0,0,0], [0,1,1], [0,0,1]] Outp 阅读全文
posted @ 2020-05-13 11:23 habibah_chang 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定一个年龄数组,代表一组人的年龄,他们任何一个人A会向除了以下3个条件外的任意B发送好友请求,A->B age[B] <= 0.5 * age[A] + 7 age[B] > age[A] age[B] > 100 && age[A] < 100 请问,一共可能发送多少请求。 Exampl 阅读全文
posted @ 2020-05-12 17:15 habibah_chang 阅读(147) 评论(0) 推荐(0) 编辑
上一页 1 ··· 28 29 30 31 32 33 34 35 36 ··· 44 下一页