07 2022 档案

摘要:What is a complete binary tree? A complete binary tree is a binary tree in which all the levels except the last level, i.e., leaf node should be compl 阅读全文
posted @ 2022-07-21 12:55 奋斗中的菲比 阅读(112) 评论(0) 推荐(0) 编辑
摘要:binary search binary search time complexity = O(logn) the question usually give you a sorted array and then find a target(index) in the value: the big 阅读全文
posted @ 2022-07-19 20:36 奋斗中的菲比 阅读(27) 评论(0) 推荐(0) 编辑
摘要:不是O(N^2) ,是O(N)。两个指针遍历了整个数组一次 时间复杂度与最内层循环主体的执行次数有关与有多少重循环无关. The time complexity is related to the number of executions of the innermost loop body, in 阅读全文
posted @ 2022-07-19 19:19 奋斗中的菲比 阅读(19) 评论(0) 推荐(0) 编辑
摘要:228 · Middle of Linked List 快慢指针 慢走1, 快每次走2 初始化的时候 slow = head; fast =head.next; 并且 while的时候 java是从左到右检查 while(last!=null && last.next!=null) 如果写成 whi 阅读全文
posted @ 2022-07-17 09:26 奋斗中的菲比 阅读(13) 评论(0) 推荐(0) 编辑
摘要:旋转数组: 1790 · Rotate String II: 这里需要注意的是substring的 indexstart :inclusive, indexend: exclusive 2.offset need to be modulo int offset = (left - right) % 阅读全文
posted @ 2022-07-17 07:59 奋斗中的菲比 阅读(26) 评论(0) 推荐(0) 编辑
摘要:Type argument cannot be primitive type ~~HashMap<Integer,boolean> hashMap = new HashMap<Integer, boolean>();~~ it should use Boolean instead of boolea 阅读全文
posted @ 2022-07-14 18:17 奋斗中的菲比 阅读(8) 评论(0) 推荐(0) 编辑
摘要:Approach 4: Using Hashmap Algorithm The idea behind this approach is as follows: If the cumulative sum(represented by sum[i]sum[i] for sum up to i^{th 阅读全文
posted @ 2022-07-13 15:44 奋斗中的菲比 阅读(31) 评论(0) 推荐(0) 编辑
摘要:Trie: 前缀树 递归:如果每一层循环的内容都是一样的操作,那么可以用递归。 阅读全文
posted @ 2022-07-06 14:16 奋斗中的菲比 阅读(14) 评论(0) 推荐(0) 编辑
摘要:Note: String objects are stored in a special memory area known as the "string constant pool". features - immutable str is a string make string sorted; 阅读全文
posted @ 2022-07-06 13:20 奋斗中的菲比 阅读(14) 评论(0) 推荐(0) 编辑
摘要:you can't initialize array like this way: public static final String dic[4] = {"33","3","4","5"}; I don't know why you can't assign the length of the 阅读全文
posted @ 2022-07-01 20:55 奋斗中的菲比 阅读(24) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示