摘要:
When we get this problem, we need to confirm the following 2 questions: 1. Can root, p or q be null? (No) 2. Are both p and q in the tree (No, either 阅读全文
摘要:
When we get this problem, we need to confirm the following 3 questions: 1. Can root, p or q be null? (No) 2. Are both p and q in the tree (yes) 3. Can 阅读全文
摘要:
Although this is an easy question, but it is prone to bugs, and the code can be better. Following is my first solution, didn't use the feature of BST. 阅读全文
摘要:
For sparse venctors, there might be too many "0"s in the array. What we need to do is only abstract the items which are not "0". We store these non-ze 阅读全文
摘要:
My first solution is use two skacks, one stack store index, another one store value, the time complexity is O(n). public int[] findBuildings(int[] hei 阅读全文