码迷,mamicode.com
首页 >  
搜索关键字:problems    ( 6275个结果
[LeetCode]House Robber
原题链接:https://leetcode.com/problems/house-robber/题意描述:You are a professional robber planning to rob houses along a street. Each house has a certain amo...
分类:其他好文   时间:2015-04-06 18:27:43    阅读次数:132
Palindrome Partitioning
https://leetcode.com/problems/palindrome-partitioning/Given a strings, partitionssuch that every substring of the partition is a palindrome.Return all...
分类:其他好文   时间:2015-04-06 15:23:49    阅读次数:112
Leetcode #169 Majority Element
题目链接:https://leetcode.com/problems/majority-element/官方的Solution:Runtime: O(n2) — Brute force solution: Check each element if it is the majority elemen...
分类:其他好文   时间:2015-04-06 14:06:30    阅读次数:115
Leetcode #137 Single Number II
题目链接:https://leetcode.com/problems/single-number-ii/题意表明有一个数字出现了一次,其他数字出现了三次,那么实现一个模3的计数器即可。 1 class Solution 2 { 3 public: 4 int singleNumber(int...
分类:其他好文   时间:2015-04-06 12:49:26    阅读次数:152
Leetcode #144 Binary Tree Preorder Traversal
题目链接:https://leetcode.com/problems/binary-tree-preorder-traversal/(非递归实现)二叉树的先序遍历。 1 class Solution 2 { 3 public: 4 vector preorderTraversal(TreeN...
分类:其他好文   时间:2015-04-05 23:31:23    阅读次数:144
Simplify Path
https://leetcode.com/problems/simplify-path/Given an absolute path for a file (Unix-style), simplify it.Given an absolute path for a file (Unix-style)...
分类:其他好文   时间:2015-04-05 23:29:44    阅读次数:193
Leetcode #94 Binary Tree Inorder Traversal
题目链接:https://leetcode.com/problems/binary-tree-inorder-traversal/(非递归实现)二叉树的中序遍历。 1 class Solution 2 { 3 public: 4 vector inorderTraversal(TreeNod...
分类:其他好文   时间:2015-04-05 23:29:30    阅读次数:149
Leetcode #96 Unique Binary Search Trees
题目链接:https://leetcode.com/problems/unique-binary-search-trees/从最简单的情况开始考虑:n = 0 :只有“空树”这一种情况。f[0]= 1。n = 1 :只有“根节点”这一种情况。f[1]= 1。n = 2 :由于“根节点”必须存在,所以...
分类:其他好文   时间:2015-04-05 23:28:47    阅读次数:171
Leetcode #188 Best Time to Buy and Sell Stock IV
题目链接:https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iv/当 k ≥ prices.size()/ 2 时:题目等价于 k 无限大的情形。当 k < prices.size()/ 2 时:用dp[m][n+1]表示在[...
分类:其他好文   时间:2015-04-05 23:27:12    阅读次数:161
Leetcode #145 Binary Tree Postorder Traversal
题目链接:https://leetcode.com/problems/binary-tree-postorder-traversal/(非递归实现)二叉树的后序遍历。 1 class Solution 2 { 3 public: 4 vector postorderTraversal(Tre...
分类:其他好文   时间:2015-04-05 23:24:15    阅读次数:160
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!