摘要:
很锻炼DP/recursive思路的一道题,个人感觉DP/recursive算是比较难写的题目了。这道题解法的巧妙之处在于巧用-1,并且使用临时存储,节省了很多开支。这道题同时也在Career Cup上面出现过 这道题我两次调试通过,第一次错是因为input{}, output false, exp 阅读全文
摘要:
Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest le... 阅读全文
摘要:
Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical and the nodes have the same value. 1 public... 阅读全文
摘要:
Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, ... 阅读全文