2014年8月15日

二叉树最近公共祖先

摘要: LCA算法:后续遍历+Flag 1 int Solution::search_lca(TreeNode *root, TreeNode *node1, TreeNode *node2, int &flag, TreeNode *pres) 2 {//查找二叉树公共祖先 3 if (root ... 阅读全文

posted @ 2014-08-15 15:10 雨歌_sky 阅读(253) 评论(0) 推荐(0) 编辑

leetcode -- Implement strStr()

摘要: 反正总是有人要赢,那为什么不能是我呢~[问题描述]Implement strStr().Returns a pointer to the first occurrence of needle in haystack, ornullif needle is not part of haystack.[... 阅读全文

posted @ 2014-08-15 12:25 雨歌_sky 阅读(158) 评论(0) 推荐(0) 编辑

leetcode -- Pow(x, n)

摘要: 不求与人相比,但求超越自己[问题描述]Implement pow(x,n).[解题思路]任何一个数x均可以被表示成 x = K^(2^a + 2^b + .....) 1 double Solution::pow(double x, int n) 2 { 3 int flag = 1; 4 ... 阅读全文

posted @ 2014-08-15 10:10 雨歌_sky 阅读(109) 评论(0) 推荐(0) 编辑

2014年8月14日

leetcode -- Binary Tree Postorder Traversal

摘要: 历史不容假设[问题描述]Given a binary tree, return thepostordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3retu... 阅读全文

posted @ 2014-08-14 16:40 雨歌_sky 阅读(124) 评论(0) 推荐(0) 编辑

2014年8月13日

leetcode -- Valid Parentheses

摘要: 不要因为走的太远而忘记我们为什么出发[问题描述]Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets mu... 阅读全文

posted @ 2014-08-13 22:00 雨歌_sky 阅读(126) 评论(0) 推荐(0) 编辑

leetcode -- String to Integer (atoi)

摘要: 本以为四年恒久远,哪知转眼一瞬间[问题描述]Implementatoito convert a string to an integer.Hint:Carefully consider all possible input cases. If you want a challenge, please... 阅读全文

posted @ 2014-08-13 21:23 雨歌_sky 阅读(124) 评论(0) 推荐(0) 编辑

leetcode -- Merge Two Sorted Lists

摘要: 上帝和每个人开的玩笑都不一样[问题描述]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... 阅读全文

posted @ 2014-08-13 20:18 雨歌_sky 阅读(130) 评论(0) 推荐(0) 编辑

leetcode -- Word Ladder

摘要: 爱情也有好赖,决不能草率,我是愿意等待,哪怕青春不再[问题描述]Given two words (startandend), and a dictionary, find the length of shortest transformation sequence fromstarttoend, s... 阅读全文

posted @ 2014-08-13 18:29 雨歌_sky 阅读(133) 评论(0) 推荐(0) 编辑

leetcode -- 问题难度分布

摘要: 他是学术史上最杰出的一个天才,是人类无法逾越的一道障碍Diff: 难度等级Freq: 面试频率等级转载http://blog.csdn.net/kenden23/article/details/14109347 阅读全文

posted @ 2014-08-13 14:42 雨歌_sky 阅读(180) 评论(0) 推荐(0) 编辑

leetcode -- Two Sum

摘要: 文能深情寻萝莉,武能仗义护人妻[问题描述]Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return ... 阅读全文

posted @ 2014-08-13 14:07 雨歌_sky 阅读(138) 评论(0) 推荐(0) 编辑

导航