代码改变世界

阅读排行榜

[LeetCode]Binary Tree Right Side View

2015-04-06 17:36 by 庸男勿扰, 200 阅读, 收藏,
摘要: 原题链接:https://leetcode.com/problems/binary-tree-right-side-view/题意描述:Given a binary tree, imagine yourself standing on therightside of it, return the v... 阅读全文

[LeetCode]Binary Tree Preorder Traversal

2014-03-14 00:20 by 庸男勿扰, 191 阅读, 收藏,
摘要: 原题链接:http://oj.leetcode.com/problems/binary-tree-preorder-traversal/题意描述:Given a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,2,3].Note:Recursive solution is trivial, could you do it iteratively?题解: 裸的二叉树遍历,没什么... 阅读全文

[LeetCode]Linked List Cycle II

2014-03-14 17:12 by 庸男勿扰, 183 阅读, 收藏,
摘要: 原题链接:http://oj.leetcode.com/problems/linked-list-cycle-ii/题意描述:Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it without using extra space?题解: 这道题的v1版本是判断一个单链表是否有环,当时我们采用的是快慢指针的方法。传送门:http://www.cnblogs.com/codershell/p/3600100.. 阅读全文

[LeetCode]Reverse Integer

2014-03-14 23:53 by 庸男勿扰, 175 阅读, 收藏,
摘要: 原题链接:http://oj.leetcode.com/problems/reverse-integer/题意描述:Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321click to show spoilers.Have you thought about this?Here are some good questions to ask before coding. Bonus points for you if you have already thought thro 阅读全文

[LeetCode]Minimum Path Sum

2014-03-14 16:06 by 庸男勿扰, 138 阅读, 收藏,
摘要: 原题链接:http://oj.leetcode.com/problems/minimum-path-sum/题意描述: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:You can only move either down or right at any point in time.题解: 这是提到基本的动态规划题,转移方程为:dp[i][j] . 阅读全文