该文被密码保护。 阅读全文
摘要:
When we met path or parentheses problems, always think about Stack first. For this problem, only three conditions need to be considered: 1. the substr 阅读全文
摘要:
Same: Both of Stack and Dequeu can be a stack. Differences: 1. Deque is a LinkedList, Stack is a Stack. 2. Dequeu can getFirst() and getLast(), but St 阅读全文
摘要:
This problem should not use DFS to solve it, I have tried, but failed with this test case: [3,9,8,4,0,1,7,null,null,null,2,5] My output is: [[4],[9,5] 阅读全文
摘要:
This is a Iterator problem too, the soltuion is: 1. keep a variable, nextInt, to store the potential next Integer. 2. when peek(), if the nextInt is n 阅读全文
摘要:
This is an itegrator problem. You can look nestedList as a tree, just recursively read the nestedList, and put the integration into a list, and then i 阅读全文
摘要:
This is a similar problem with "543. Diameter of Binary Tree", the only difference is 543 is a binary tree, and 1522 is an n_ary tree. For 1522, we ne 阅读全文
摘要:
This is a Post Order binary tree problem. For every node, we need to know its left tree's maximal diameter and its right tree's maximal diameter, and 阅读全文
摘要:
This is a "In Order" traversal problem, because the order of the result is a in order or the tree. 1. The problem need to return the pointer to the sm 阅读全文