Algorithms
文章平均质量分 70
Lucky0604
这个作者很懒,什么都没留下…
展开
-
Leetcode刷题训练第六周
动态规划 文章目录动态规划 Leetcode 53: Maximum Subarrayeasy todo: explanation Leetcode 198: House Robbermedium 解题思路: 对数组中任意一个house,我们可以选择rob或not rob 考虑到security system机制:it will automatically contact the police if two adjacent houses were broken into on the same原创 2021-06-27 14:04:59 · 140 阅读 · 0 评论 -
Leetcode刷题训练第五周
文章目录Backtracking Backtracking Leetcode 401easy 解题思路: 此题关键点在于理解题意 分钟为必须为2位数,可以包含开头为0,例如"1:2"是不合法的,应为"1:02" 小时位不允许开头为0,例如"01:00"是不合法的,应为"1:00" 代表分钟的一列有6个灯,分别是[1, 2, 4, 8, 16, 32], 表示0~59区间(分钟最大显示是59,到60为0) 代表小时的一列有4个灯,分别是[1, 2, 4, 8],表示0~11区间(因为小时最大是11,到1原创 2021-06-18 14:34:33 · 105 阅读 · 0 评论 -
Leetcode刷题训练第四周
文章目录数组 数组 Leetcode 119: Pascal’s Triangle IIeasy 解题关键: 暴力解法,构造pascal’s triangle, 找到对应rowIndex的行,构造成List// 构造pascal's triangle的逻辑, 注意数组长度是rowIndex + 1 int[][] triangle = new int[rowIndex + 1][rowIndex + 1] for (int i = 0; i < rowIndex + 1; i ++) { f原创 2021-06-11 13:27:40 · 121 阅读 · 0 评论 -
Leetcode刷题训练第三周
文章目录二分法 二分法 Leetcode 852: Peak Index in a Mountain Arrayeasy原创 2021-06-06 01:29:20 · 101 阅读 · 0 评论 -
Leetcode刷题训练第二期
文章目录递归复习:数组二分法 递归复习: Leetcode 92: Reverse Linked List II 解题关键: 如何找到对应索引位置的node for (int i = 1; i < left; i ++) { pre = pre.next; leftNode = leftNode.next; } for (int i = 1; i < right; i ++) { rightNode = rightNode.next; } 反转链表的写法原创 2021-05-30 10:56:49 · 123 阅读 · 0 评论 -
递归算法及题目示例
文章目录递归 递归 题解链接 Leetcode 104 - 二叉树的最大深度 leetcode 62 - 不同路径 剑指offer 16 - 数值的整数次方原创 2021-05-17 00:07:44 · 143 阅读 · 0 评论