摘要: 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... 阅读全文
posted @ 2014-06-22 23:21 OpenSoucre 阅读(125) 评论(0) 推荐(0) 编辑
摘要: Given amxngrid filled with non-negative numbers, find a path from top left to bottom right whichminimizesthe sum of all numbers along its path.Note:Yo... 阅读全文
posted @ 2014-06-22 22:49 OpenSoucre 阅读(429) 评论(0) 推荐(0) 编辑
摘要: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.简单的链表合并题L... 阅读全文
posted @ 2014-06-22 22:25 OpenSoucre 阅读(126) 评论(0) 推荐(0) 编辑
摘要: You are climbing a stair case. It takesnsteps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb... 阅读全文
posted @ 2014-06-22 22:14 OpenSoucre 阅读(122) 评论(0) 推荐(0) 编辑
摘要: Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the fol... 阅读全文
posted @ 2014-06-22 21:35 OpenSoucre 阅读(296) 评论(0) 推荐(0) 编辑
摘要: Given an indexk, return thekthrow of the Pascal's triangle.For example, givenk= 3,Return[1,3,3,1].Note:Could you optimize your algorithm to use onlyO(... 阅读全文
posted @ 2014-06-22 20:28 OpenSoucre 阅读(505) 评论(0) 推荐(0) 编辑
摘要: GivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]... 阅读全文
posted @ 2014-06-22 20:01 OpenSoucre 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 第5节 宝岛探险利用广度优先搜索实现其中可以不用开辟visit变量,直接用将本身的值改为-1,然后判断即可注意输入数据时周围加了一层-1,作为边界广度优先搜索利用深度优先搜索实现,注意下面的方法是将搜索到的点着成-1的颜色深度优先搜索注意如果n和m比较大的话,建议用广度优先搜索,由于深度优先搜索,一... 阅读全文
posted @ 2014-06-22 15:44 OpenSoucre 阅读(435) 评论(0) 推荐(0) 编辑