Posts

移动窗口类型

发现这道题居然没有归类 就是 32. Minimum Window Substring 647. Find All Anagrams in a String 386. Longest Substring with At Most K Distinct Characters 这也是一大类。 缘起: 给两个string,一个source,一个target,在source中找包含target 的最短的subtring。这是典型移动窗口类。在array或string中移动一个窗口,每次移动要更新窗口的结果。 数据结构: 借助hash或是vector 去找到每个元素出现次数。窗口移动时,旧的元素次数减一,新的次数加一。 32这个题有些弯弯绕,但理清思路很有意思。用hashmapping 次数是0还是>0, 来变达source里面是否出现了target里面的元素。 class Solution { public : /** * @param source : A string * @param target: A string * @return: A string denote the minimum window, return "" if there is no such a string */ string minWindow ( string &source , string &target) { // write your code here string res = "" ; const int ss = source.size(); const int st = target.size(); if (ss < st){ return res; } unordered_map < char , int > hMp; for ( char c : target){ hMp[c]...
如此, 能安心的刷题也是幸福 深刻的体会到 马云说的 996也是一种幸福的含义 那就是珍惜现在所拥有的,因为一旦这些失去,将是沉重打击。 马云说的有道理。

03/30 list

昨日准备Apple面试,停了一天。 575. Decode String 978. Basic Calculator 1396. Set Union 640. One Edit Distance 689. Two Sum IV - Input is a BST 196. Missing Number(三种方法) 1208. Target Sum 1254. Sum of Left Leaves 1165. Subtree of Another Tree 1093. Number of Longest Increasing Subsequence 651. Binary Tree Vertical Order Traversal 473. Add and Search Word - Data structure design 663. Walls and Gates 892. Alien Dictionary 578. Lowest Common Ancestor III 448. Inorder Successor in BST

03/28 list

1095. Maximum Swap 772. Group Anagrams 645. Find the Celebrity // here will be exactly one celebrity if he/she is in the party,         //这是关键啊,一定要和interviewer clarify。如果没有这个条件,答案解法是不成立的!!!         //所以,如果遇到一个做过的题目。心里要不要激动,静下来分析题目,不要老是想着去回忆解法。切记!!! 397. Longest Continuous Increasing Subsequence 1032. Letter Case Permutation 837. Palindromic Substrings 1070. Accounts Merge 402. Continuous Subarray Sum 18. Subsets II 891. Valid Palindrome II 1251. Split Array Largest Sum // write your code here         // DP 题,看了答案。         //开始直观的想法是把所有情况遍历一遍。注意一旦有这样的想法是,除了那几种固定的DFS解法题目。         //就可以考虑用DP。         // dp[i][j], 前j个元素,被split成i份的最大值中的最小值。         // dp[0][0] = 0;  1305. Integer to English Words

03/27 code list

137. Clone Graph 421. Simplify Path 101. Remove Duplicates from Sorted Array II 480. Binary Tree Paths 442. Implement Trie (Prefix Tree) 406. Minimum Size Subarray Sum 57. 3Sum 156. Merge Intervals 7. Serialize and Deserialize Binary Tree 86. Binary Search Tree Iterator 428. Pow(x, n) 17. Subsets 528. Flatten Nested List Iterator 420. Count and Say 515. Paint House 516. Paint House II 911. Maximum Size Subarray Sum Equals k 602. Russian Doll Envelopes 178. Graph Valid Tree 1016. Minimum Swaps To Make Sequences Increasing

珍惜当下 心里所想

翻看大致去年这个时候的刷题日志 以及零零星星记录下的当时心理状态 过去一年其实自己在struggling跳槽的事情, 从年初准备2月份的Google,到4月份准备5月份的LinkedIn。 6,7月份是个低落期,8月份振作,每个保持20道题的速度,到9月份面Microsoft。 11月份电面Amazon等等。中间还夹杂着其他公司一些电面。去年就是这样过来的, 但最终没有成功的结果。 然后时间来到现在,被裁员。 我一直觉得在面试上,自己缺少些什么。技术,随机应变,气场,自信,可能都缺少些。 时常觉得自己弱小。 前天,听牧师讲道,心里完全被触动,以至于泪流满面。觉得我找到了归宿,找到了心灵的家园,找到了力量。感谢神的无所不能,昨天让我有一个offer,有了一个让我们在这里继续生活下去的保障。感谢神的所赐。祈祷神的大爱,给我力量,弥补我之前面试中所表现的软弱。让我继续在接下来的面试中有成功。祷告奉耶稣基督之名,阿门!

3/26 code list

510. Maximal Rectangle 1201. Next Greater Element II 1206. Next Greater Element I 919. Meeting Rooms II 920. Meeting Rooms 152. Combinations 1191. Longest Uncommon Subsequence II 15. Permutations 124. Longest Consecutive Sequence 512. Decode Ways 69. Binary Tree Level Order Traversal 32. Minimum Window Substring 95. Validate Binary Search Tree 192. Wildcard Matching 88. Lowest Common Ancestor of a Binary Tree