码迷,mamicode.com
首页 >  
搜索关键字:triangle leetcode    ( 35974个结果
【LeetCode】LeetCoode 大牛解法转载
http://blog.unieagle.net/category/develop/%E7%AE%97%E6%B3%95/
分类:其他好文   时间:2014-05-10 01:01:59    阅读次数:223
【LeetCode】Populating Next Right Pointers in Each Node
Populating Next Right Pointers in Each NodeGiven a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLi...
分类:其他好文   时间:2014-05-10 00:32:56    阅读次数:326
【LeetCode】Best Time to Buy and Sell Stock II
Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete a...
分类:其他好文   时间:2014-05-10 00:24:49    阅读次数:255
Highly divisible triangular number
我的那个暴力求解,太耗时间了。用了网上产的什么因式分解,质因数之类的。确实快!还是数学基础不行,只能知道大约。The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangl...
分类:其他好文   时间:2014-05-09 23:43:16    阅读次数:342
Leetcode | Median of Two Sorted Arrays
There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be ...
分类:其他好文   时间:2014-05-09 23:26:18    阅读次数:353
Leetcode:Construct Binary Tree 前序和中序、后序和中序构建二叉树
前序和中序构建二叉树后序和中序构建二叉树分析:主要思路就是 在中序中找根节点然后划分左右子树,具体如下:1. 查找根节点。 我们知道前序序列的第一个元素 和 后序序列的最后一个元素 肯定是根节点,我们就以此为突破口2. 确定根节点的坐标。 我们在 中序序列中找到 根节点 的下标。3. 分割左右子树。...
分类:其他好文   时间:2014-05-09 23:17:30    阅读次数:458
Leetcode | N-Queens I & II
N-Queens IThen-queens puzzle is the problem of placingnqueens on ann×nchessboard such that no two queens attack each other.Given an integern, return a...
分类:其他好文   时间:2014-05-09 20:34:01    阅读次数:335
Leetcode | Parentheses 相关
Generate ParenthesesGiven n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a...
分类:其他好文   时间:2014-05-09 20:09:32    阅读次数:333
【LeetCode】Best Time to Buy and Sell Stock III
转载:http://blog.csdn.net/fightforyourdream/article/details/14503469题目:最佳时间买入卖出股票:你有一个数组保存了股票在第i天的价钱,现在你最多进行两次买卖,但同一时间你手上只能保持一个股票,如何赚的最多思路:知道要用DP做,但是一开始...
分类:其他好文   时间:2014-05-09 20:01:47    阅读次数:335
leetcode第一刷_Unique Binary Search Trees
这道题其实跟二叉搜索树没有什么关系,给定n个节点,让你求有多少棵二叉树也是完全一样的做法。思想是什么呢,给定一个节点数x,求f(x),f(x)跟什么有关系呢,当然是跟他的左右子树都有关系,所以可以利用其左右子树的结论,大问题被成功转化成了小问题。最熟悉的方法是递归和dp,这里显然有大量的重复计算,用dp打表好一些。 后来实验的同学说,这其实是一个Catalan数,上网查了一下,果然啊。Catal...
分类:其他好文   时间:2014-05-09 14:47:53    阅读次数:229
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!