摘要: Implement int sqrt(int x).Compute and return the square root of x.思考:参考链接:http://www.cnblogs.com/pkuoliver/archive/2010/10/06/sotry-about-sqrt.htmlclass Solution {public: int sqrt(int x) { // Start typing your C/C++ solution below // DO NOT write int main() function double an... 阅读全文
posted @ 2013-11-18 16:09 七年之后 阅读(201) 评论(0) 推荐(0) 编辑
摘要: Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.Above is a histogram where width of each bar is 1, given height = [2,1,5,6,2,3].The largest rectangle is shown in the shaded area, which has 阅读全文
posted @ 2013-11-18 14:48 七年之后 阅读(204) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between).For example: Given binary tree {3,9,20,#,#,15,7}, 3 / \ 9 20 / \ 15 7return its zigzag level order traversal as:[ [... 阅读全文
posted @ 2013-11-18 14:42 七年之后 阅读(143) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example: Given binary tree {3,9,20,#,#,15,7}, 3 / \ 9 20 / \ 15 7return its level order traversal as:[ [3], [9,20], [15,7]]confused what "{1,#,2,3}" means? > rea. 阅读全文
posted @ 2013-11-18 13:59 七年之后 阅读(184) 评论(0) 推荐(0) 编辑