Given a binary tree containing digits from 0-9 only, each root-to-leafpath could represent a number. An example is the root-to-leaf path 1->2->3 which represents thenumber 123. Find the total sum of all root-to-leaf numbers. For example, {代码...} Return the sum = 12 + 13 = 25.
Given a binary tree, find the maximum path sum. For this problem, a path is defined as any sequence of nodes from somestarting node to any node in the tree along the parent-childconnections. The path does not need to go through the root. For example: Given the below binary tree, {代码...}
Given a binary tree and a sum, determine if the tree has aroot-to-leaf path such that adding up all the values along the pathequals the given sum. For example: Given the below binary tree and sum = 22, {代码...}
Given two binary trees, write a function to check if they are equal ornot. Two binary trees are considered equal if they are structurallyidentical and the nodes have the same value.
Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path fromthe root node down to the nearest leaf node.
看到面试要问时间复杂度的问题才想起我似乎还不能用英文表示时间复杂度呢...这里把常用的时间复杂度的英文记录一下吧. O(1) constant time O(n) linear time O(log n) logarithmic time O(n^2) quadratic time O(n^3) cubic time O(n log n) linearithmic time