![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LC
laohixdxm00
这个作者很懒,什么都没留下…
展开
-
98. Validate Binary Search Tree
https://leetcode-cn.com/problems/validate-binary-search-tree/[bug]/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode() {} * TreeNode(int val) { this.val =原创 2021-06-28 21:08:36 · 51 阅读 · 0 评论 -
34. Find First and Last Position of Element in Sorted Array
https://leetcode-cn.com/problems/find-first-and-last-position-of-element-in-sorted-array/[bug]class Solution { public int[] searchRange(int[] nums, int target) { int[] notFound = new int[]{-1, -1}; if(nums.length==0){ ret原创 2021-06-28 17:59:43 · 71 阅读 · 0 评论 -
278. First Bad Version
https://leetcode-cn.com/problems/first-bad-version/[bug]/* The isBadVersion API is defined in the parent class VersionControl. boolean isBadVersion(int version); */public class Solution extends VersionControl { public int firstBadVersion(int原创 2021-06-28 17:02:15 · 46 阅读 · 0 评论 -
529. Minesweeper
https://leetcode-cn.com/problems/minesweeper/[bug]class Solution { char[][] upd; char[][] board; int w, h; int[][] dirs = { {-1,-1}, {-1,0}, {-1,1}, {0, -1}, {0, 1}, {1, -1}, {1, 0}原创 2021-06-18 16:52:28 · 76 阅读 · 0 评论 -
lc332 reconstruct itinarary
https://leetcode-cn.com/problems/reconstruct-itinerary/[bug]class Solution { Map<String, List<String>> adj = new HashMap<>(); public List<String> findItinerary(List<List<String>> tickets) { int n原创 2021-06-18 15:41:30 · 69 阅读 · 0 评论 -
200. Number of Islands [dfs]
https://leetcode-cn.com/problems/number-of-islands/submissions/[bug]class Solution { char[][] grid; int w, h; boolean[][] visited; int[][] dirs = {{-1,0}, {1,0}, {0,-1}, {0,1}}; public int numIslands(char[][] grid) { th原创 2021-06-18 14:45:32 · 46 阅读 · 0 评论 -
200. Number of Islands [union find]
https://leetcode-cn.com/problems/number-of-islands/[bug]class Solution { char[][] grid; int w, h; int[][] dirs = {{-1,0}, {1,0}, {0,-1}, {0,1}}; Map<Integer, Integer> map = new HashMap<>(); public int numIslands(char[][]原创 2021-06-18 13:54:55 · 147 阅读 · 0 评论 -
lc490
https://xiaoguan.gitbooks.io/leetcode/content/LeetCode/490-the-maze-medium.html[algorithm]1 what is graph? what is edge? what is node?2 write dfs pseudo3 move() method, what is relevant to this move, make it as param.on high level, use move() as block原创 2021-06-17 11:47:10 · 78 阅读 · 0 评论 -
54. Spiral Matrix
https://leetcode-cn.com/problems/spiral-matrix/[wrong code]class Solution { public List<Integer> spiralOrder(int[][] matrix) { int h = matrix.length; int w = matrix[0].length; boolean[][] visited = new boolean[h][w];原创 2021-05-10 20:26:20 · 45 阅读 · 0 评论 -
24. 两两交换链表中的节点
[lc24]https://leetcode-cn.com/problems/swap-nodes-in-pairs/[brainstorm]1-2-3-4 -> 2-1-4-31-2 -> 2-13-4 -> 4-3why recursion rathen than iteration?4 is linked list head of 4-3which result of sub problem 3-4.in summary, say merge sub1 and su原创 2021-05-07 10:02:42 · 47 阅读 · 0 评论 -
剑指 Offer 07 重建二叉树 LCOF
[wrong code]/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { int n; public TreeNode buildTree(int[] pre原创 2021-05-06 21:38:22 · 45 阅读 · 0 评论 -
11. Container With Most Water
https://leetcode-cn.com/problems/container-with-most-water/[lc11]1 why move smaller?as it goes narrower, it cause height go bigger.5,7 - 55,8 - 58,7 - 72 why only bigger num should be candidate?as it goes narrower, so height should be go higher.3原创 2021-05-02 23:26:15 · 40 阅读 · 0 评论 -
22. Generate Parentheses
https://leetcode-cn.com/problems/generate-parentheses/[lc22]1 solved by dfs, draft tree diagram.2 when to cut branch?left depth is over right right deptheither left or right depth is over boundary n3 at each node, return from left or right branch, sh原创 2021-05-02 13:11:25 · 48 阅读 · 0 评论 -
19. Remove Nth Node From End of List
https://leetcode-cn.com/problems/remove-nth-node-from-end-of-list/[lc19]1 locate node to prior to deleted node.adjust next pointer to remove deleted node.2 how to locate deleted node in one scan?location to pointer change should be done together.3 lo原创 2021-05-02 13:05:31 · 47 阅读 · 0 评论 -
2. Add Two Numbers
https://leetcode-cn.com/problems/add-two-numbers/1 scan input list from left to right, and add corresponding digit2 general case, sum = l1.val + l2.val + carry3 how to handle when two list has not equal length?[bug]1 while(c1!=null || c2!=null) {…}原创 2021-05-02 00:38:16 · 68 阅读 · 0 评论 -
445. Add Two Numbers II
这里写自定义目录标题欢迎使用Markdown编辑器新的改变功能快捷键合理的创建标题,有助于目录的生成如何改变文本的样式插入链接与图片如何插入一段漂亮的代码片生成一个适合你的列表创建一个表格设定内容居中、居左、居右SmartyPants创建一个自定义列表如何创建一个注脚注释也是必不可少的KaTeX数学公式新的甘特图功能,丰富你的文章UML 图表FLowchart流程图导出与导入导出导入欢迎使用Markdown编辑器你好! 这是你第一次使用 Markdown编辑器 所展示的欢迎页。如果你想学习如何使用Mar原创 2021-05-02 00:19:31 · 62 阅读 · 0 评论