码迷,mamicode.com
首页 >  
搜索关键字:train problem ii    ( 44369个结果
hdu4460之BFS
Friend Chains Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2882    Accepted Submission(s): 970 Problem Description For a group o...
分类:其他好文   时间:2014-05-15 11:21:04    阅读次数:438
Leetcode 树 Unique Binary Search TreesII
本文为senlie原创,转载请保留此地址:http://blog.csdn.net/zhengsenlie Unique Binary Search Trees II  Total Accepted: 7349 Total Submissions: 27648 Given n, generate all structurally unique ...
分类:其他好文   时间:2014-05-15 07:02:36    阅读次数:252
HDU 3530 单调队列
Subsequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 3995    Accepted Submission(s): 1308 Problem Description There is a sequenc...
分类:其他好文   时间:2014-05-15 06:47:40    阅读次数:275
Leetcode 树 Binary Tree Level Order Traversal II
题意:从底往上按层遍历二叉树 思路: 思路和Binary Tree Level Order Traveral 一样, 即从上往下按层遍历二叉树,将每一层的节点存放到该层对应的数组中 最后将得到的数组倒转一下就可以了 按层遍历二叉树可用bfs,也可用dfs,但都要记录节点所在的层 复杂度:时间O(n), 空间O(n)...
分类:其他好文   时间:2014-05-15 06:32:14    阅读次数:278
leetcode第一刷_Jump Game II
要求最小的步数,是不是很容易想到用dp啊? 我一开始的做法是,当找到了一个可以从它延伸到更远的位置,就把这个位置和最远位置的步数都更新一下,结果超时了。其实这样不仅是超时的,而且是错误的。因为这段距离里的很多点,其实是上一步就能到达的。其实应该更新的只有哪些新的能够到达的点,那哪些点是新的能到达的点呢?假设这次能够延伸更远的点是i,它的前进步数是A[i],上一次能够到达的最远的点是mmax,那新...
分类:其他好文   时间:2014-05-15 05:54:41    阅读次数:229
leetcode第一刷_Permutations II
当有重复元素的时候呢? 不用拍脑袋都会想到一种方法,也是所有有重复元素时的通用处理方法,维护一个set,如果这个元素没加入过就加入,加入过了的忽略掉。但是,在这道题上这个通用方法居然超时了! 怎么办?想一下为什么会这样,假设我们要排列的数字是1111112,当当前的排列中没有1时,取哪个1生成一遍,都是一样的。只有当前面的1都用过了,必须轮到这个1出场的时候,它才会有价值。更明确一点说,假设我...
分类:其他好文   时间:2014-05-15 05:36:25    阅读次数:198
[LeetCode]String to Integer (atoi)
Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input cases. Notes: It is intended for this problem to be specifi...
分类:其他好文   时间:2014-05-15 05:00:50    阅读次数:229
HDU4768:Flyer(二分)
Problem Description The new semester begins! Different kinds of student societies are all trying to advertise themselves, by giving flyers to the students for introducing the society. However, due ...
分类:其他好文   时间:2014-05-15 03:57:24    阅读次数:311
hdu1269迷宫城堡 (强连通Tarjan+邻接表)
Problem Description 为了训练小希的方向感,Gardon建立了一座大城堡,里面有N个房间(N Input 输入包含多组数据,输入的第一行有两个数:N和M,接下来的M行每行有两个数a和b,表示了一条通道可以从A房间来到B房间。文件最后以两个0结束。 Output 对于输入的每组数据,如果任意两个房间都是相互连接的,输出"Yes",否则输出"No"。...
分类:其他好文   时间:2014-05-15 03:56:41    阅读次数:205
leetcode题目:Palindrome Partitioning 和Palindrome Partitioning II
题目一: Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. For example, given s = "aab", Return [ ...
分类:其他好文   时间:2014-05-14 15:10:01    阅读次数:293
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!