摘要: 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 l 阅读全文
posted @ 2014-05-19 17:27 Double_win 阅读(186) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest l 阅读全文
posted @ 2014-05-19 17:19 Double_win 阅读(270) 评论(0) 推荐(0) 编辑
摘要: A robot is located at the top-left corner of amxngrid (marked 'Start' in the diagram below).The robot can only move either down or right at any point ... 阅读全文
posted @ 2014-05-09 23:38 Double_win 阅读(152) 评论(0) 推荐(0) 编辑
摘要: Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5,Return 转载请注明出处: http://www.cnblogs.com/double-win/ 谢谢! 阅读全文
posted @ 2014-05-05 15:39 Double_win 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 前言 【LeetCode 题解】系列传送门: http://www.cnblogs.com/double-win/category/573499.html 1.题目描述 Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numb... 阅读全文
posted @ 2014-05-05 15:01 Double_win 阅读(347) 评论(0) 推荐(0) 编辑
摘要: 前言 【LeetCode 题解】系列传送门: http://www.cnblogs.com/double-win/category/573499.html 1.题目描述 Implement pow(x, n). 2. 思路 题目很精简,不过需要考虑的情况很多,特别的需要注意 n可能为0 或者负数的情况。 另外,通过二分法,可以减少计算量。 3. 解法 clas... 阅读全文
posted @ 2014-05-04 16:59 Double_win 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 前言 【LeetCode 题解】系列传送门: http://www.cnblogs.com/double-win/category/573499.html 1.题目描述 Given a non-negative number represented as an array of digits, plus one to the number. The digits ar... 阅读全文
posted @ 2014-05-04 11:39 Double_win 阅读(241) 评论(0) 推荐(0) 编辑
摘要: 前言 【LeetCode 题解】系列传送门: http://www.cnblogs.com/double-win/category/573499.html 1.题目描述 The string"PAYPALISHIRING"is written in a zigzag pattern on a given number of rows like this: (you ma... 阅读全文
posted @ 2014-04-25 00:19 Double_win 阅读(379) 评论(0) 推荐(0) 编辑
摘要: 在下面的程序中,在编译时会遇到下面的错误:error: field 'b' has incomplete type域b是一个不完备的类型,即class B的声明不完备 1 #include 2 using namespace std; 3 4 class A 5 { 6 private:... 阅读全文
posted @ 2014-04-23 18:23 Double_win 阅读(680) 评论(0) 推荐(0) 编辑
摘要: Tips: 本文中所求的最小公倍数的对象都是正数!在求两个分数的最小公倍数之前,我们可以先来回顾一下如何求两个自然数的最小公倍数:1. 两个自然数的最小公倍数假设已知两个自然数a和b,求两者的最小公倍数 f(a,b):(1) 如果两个数互质,那么易知最小公倍数为f(a,b) = a*b;(2)如果两... 阅读全文
posted @ 2014-04-22 20:10 Double_win 阅读(3341) 评论(0) 推荐(0) 编辑