上一页 1 ··· 32 33 34 35 36 37 38 39 40 ··· 44 下一页
摘要: 问题: 给定一个矩阵,1代表活,0代表死,进行下列转化,求所得矩阵 1.对于一个活节点,若周围8个cell,有小于2个活着,那么变死节点 2.对于一个活节点,若周围8个cell,有2或3个活着,那么保持活节点 3.对于一个活节点,若周围8个cell,有大于3个活着,那么变死节点 4.对于一个死节点, 阅读全文
posted @ 2020-04-11 11:02 habibah_chang 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定一个包含n + 1个整数的数组,其中每一个整数均介于[1, n]之间,求重复的数字。 Example 1: Input: [1,3,4,2,2] Output: 2 Example 2: Input: [3,1,3,4,2] Output: 3 Note: You must not mo 阅读全文
posted @ 2020-04-05 14:14 habibah_chang 阅读(102) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定数组,求除本位数字以外所有数字之乘积的新数组 Example: Input: [1,2,3,4] Output: [24,12,8,6] Constraint: It's guaranteed that the product of the elements of any prefix 阅读全文
posted @ 2020-04-05 13:09 habibah_chang 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 同样思想的升级版【https://www.cnblogs.com/habibah-chang/p/12743884.html】 问题: 给定StartWord和EndWord,在给定的dict中寻找每次值变换一个字母,最终从StartWord能够推移到EndWord的一个序列步数。 Note: Re 阅读全文
posted @ 2020-04-05 11:38 habibah_chang 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 问题: 求给定数组中,最长连续递增子数组 Example 1: Input: [1,3,5,4,7] Output: 3 Explanation: The longest continuous increasing subsequence is [1,3,5], its length is 3. E 阅读全文
posted @ 2020-04-04 17:26 habibah_chang 阅读(90) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定任务数组,每个任务用一个大写字母表示。 给定相同任务之间的缓冲间隔 n(间隔中可填充其他任务,若没有则使之空闲 idle ) 求对给定任务一览进行安排,使得所用时间最少,求此时间。 Example: Input: tasks = ["A","A","A","B","B","B"], n 阅读全文
posted @ 2020-04-04 17:07 habibah_chang 阅读(96) 评论(0) 推荐(0) 编辑
摘要: 问题: 求给定数组中,每三个值作为三角形三边,可构成三角形的集合个数。 Example 1: Input: [2,2,3,4] Output: 3 Explanation: Valid combinations are: 2,3,4 (using the first 2) 2,3,4 (using 阅读全文
posted @ 2020-04-04 11:55 habibah_chang 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 问题:求是否给定的数列为一个山形数列(先单调增,再单调减) Example 1: Input: [2,1] Output: false Example 2: Input: [3,5,5] Output: false Example 3: Input: [0,3,2,1] Output: true N 阅读全文
posted @ 2020-03-29 16:15 habibah_chang 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 问题: 求一个数列中的,最大嵌套子数列长度 Example 1: Input: A = [5,4,0,3,1,6,2] Output: 4 Explanation: A[0] = 5, A[1] = 4, A[2] = 0, A[3] = 3, A[4] = 1, A[5] = 6, A[6] = 阅读全文
posted @ 2020-03-29 15:37 habibah_chang 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 问题: 求未排序数列中,最长连续数列长度。 Example: Input: [100, 4, 200, 1, 3, 2] Output: 4 Explanation: The longest consecutive elements sequence is [1, 2, 3, 4]. Therefo 阅读全文
posted @ 2020-03-29 14:50 habibah_chang 阅读(110) 评论(0) 推荐(0) 编辑
上一页 1 ··· 32 33 34 35 36 37 38 39 40 ··· 44 下一页