一步一个阶梯,向人类进化。
发布时间:2014-12-29 16:19:55
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together with x-axis forms a c.........【阅读全文】
发布时间:2014-12-29 15:54:09
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in place with constant memory.For example,Given input array A = [1,1,2],Your function s.........【阅读全文】
发布时间:2014-12-29 15:41:43
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 leaf node.题目很简单,但考的很基础。二叉树的遍历方式有两种:递归和非递归,本题也有两种解法。计算二叉树的深度,简单的前序遍历即可。递归算法:.........【阅读全文】