
cc150
文章平均质量分 85
Yadoer
这个作者很懒,什么都没留下…
展开
-
LeetCode-Path Sum II
题目:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For example:Given the below binary tree原创 2015-01-30 21:11:27 · 642 阅读 · 0 评论 -
Egg dropping puzzle
问题:有一个100层高的楼,如果一个鸡蛋从n层掉下来或者n层以上,鸡蛋就会碎掉。已知,现在有两个鸡蛋,找到满足条件的n,使在最坏情况下,丢鸡蛋的次数最少。原题链接可以转到wiki:点击打开链接很明显,不管egg1怎么丢,egg2肯定得线性得丢。我们假设egg1每次丢10层,即按10f, 20f, 30f, 40f, 50f, 60f, 70f, 80f, 90f, 100f。则,如原创 2015-08-18 19:40:53 · 1293 阅读 · 0 评论 -
LeetCode-Generate Parentheses & Letter Combinations of a Phone Number
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:"((()))", "(()())", "(())()", "()(())", "()()原创 2015-08-20 14:20:53 · 1094 阅读 · 0 评论