![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
cc150
laohixdxm00
这个作者很懒,什么都没留下…
展开
-
lc34 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/[brainstorm] this solution fail in 35min, fail on corner case1 use binary2 find last 8, say target=83 find first 8,then findLast, findFirst be 2 methods, can we j原创 2021-09-16 14:03:38 · 58 阅读 · 0 评论 -
08.09 面试题 08.09. Bracket LCCI
https://leetcode-cn.com/problems/bracket-lcci/[brainstorm]0/1 -1/\0 2/\ /-1 1 1 31 brute force2 ((()))see it as 1232103 brute force, get list of number string, then transform number string to () string. is it good idea?4 under some con原创 2021-09-15 21:04:01 · 62 阅读 · 0 评论 -
面试题 08.11. Coin LCCI
https://leetcode-cn.com/problems/coin-lcci/[brainstorm]1 n<0, what is return value?2 n=0, is it corner case to be handled? what is return value?3 dynamic programming, general case,[brainstorm]1 if n<0, cut branch, as solution does NOT exist2 i原创 2021-09-15 20:52:58 · 51 阅读 · 0 评论 -
面试题 04.03. List of Depth LCCI
https://leetcode-cn.com/problems/list-of-depth-lcci/[time] 25min[brainstorm]1 node in linked list is in same level, consider bfs.2 treenode is in tree structure as input, listnode is in list structure as outputso need to transform treenode to listnode原创 2021-09-14 19:49:14 · 43 阅读 · 0 评论 -
面试题 02.05. Sum Lists LCCI
https://leetcode-cn.com/problems/sum-lists-lcci/[brainstorm]1 list to num2 num to list[bug]1 cannot pass corner case[code]/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int原创 2021-09-14 17:42:44 · 57 阅读 · 0 评论 -
面试题 16.26. Calculator LCCI
https://leetcode-cn.com/problems/calculator-lcci/algorithm 10mincoding 35mindebug 15min[bug]1 first sign2 last number[buggy code]class Solution { public int calculate(String s) { String str = s.trim(); int n = str.原创 2021-06-11 20:53:02 · 55 阅读 · 0 评论 -
面试题 16.11. Diving Board LCCI
https://leetcode-cn.com/problems/diving-board-lcci/[bug]class Solution { public int[] divingBoard(int shorter, int longer, int k) { int[] ret = new int[k+1]; int i = 0; int k1 = k; int k2 = 0; while(i<k+1){原创 2021-06-10 20:21:15 · 65 阅读 · 0 评论 -
面试题 03.06. Animal Shelter LCCI
https://leetcode-cn.com/problems/animal-shelter-lcci/[bug]class AnimalShelf { int cnt; List<int[]> cats; //[0] number, [1] id List<int[]> dogs; public AnimalShelf() { cats = new ArrayList<>(); dogs =原创 2021-06-03 13:52:37 · 68 阅读 · 0 评论 -
面试题 16.17. Contiguous Sequence LCCI
[bug]class Solution { public int maxSubArray(int[] nums) { return recur(nums, 0, nums.length-1); } int recur(int[] nums, int l, int r){ if(l==r){ return nums[l]; } int mid = (l+r)/2;原创 2021-06-01 18:05:37 · 64 阅读 · 0 评论 -
面试题 17.12. BiNode LCCI
[bug]/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { public TreeNode convertBiNode(TreeNode root) {原创 2021-06-01 17:22:05 · 41 阅读 · 0 评论