摘要: 问题: 给定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) 编辑