码迷,mamicode.com
首页 >  
搜索关键字:kari oj    ( 4256个结果
LeetCode OJ - Decode ways
这道题用动规啊!!但是呢,有很多细节需要注意的啊!!特别是当0出现的时候。下面就来详细讲下啦!首先设一个长度为len+1的数组num,num[i]表示s[0...i-1]的解码方式。然后我们假设i之前的num都计算好了,现在来计算num[i],考虑s[i-1],s[i-1]一般来说有两种解码方式,一...
分类:其他好文   时间:2014-05-09 08:07:57    阅读次数:289
LeetCode OJ - Gray Code
这道题就是找规律啊!!!想想啊,11和10是可以连续的,那么10和11也是可以连续的。下面是AC代码: 1 /** 2 * The gray code is a binary numeral system where two successive values differ in on...
分类:其他好文   时间:2014-05-09 07:38:17    阅读次数:325
Edit Distance @Leetcode -- Python
http://oj.leetcode.com/problems/edit-distance/class Solution: # @return an integer def minDistance(self, word1, word2): len1 = len(word1)...
分类:编程语言   时间:2014-05-09 04:19:03    阅读次数:407
leetcode -day11 Clone Graph & Palindrome Partitioning I II
1、Clone Graph Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. OJ's undirected graph serialization: Nodes are labeled uniquely. We use # as...
分类:其他好文   时间:2014-05-09 02:17:58    阅读次数:336
旋转数组
现在对算法真的是由衷地热爱啊,总是忍不住想要A题(本科都没这意识,哎,把时间都浪费在了考试拿奖学金和所谓的学生工作上了),而且数学一直以来都是自己的强项,希望在这方面以后能应用好,虽然在ACM方面还只是个小学生,以后即使工作了,也要把ACM坚持下去,无关乎工作,只关乎兴趣。 依然是剑指offer上的题目,第8题,在九度OJ上测试通过。...
分类:其他好文   时间:2014-05-09 00:36:28    阅读次数:310
Longest Valid Parentheses @Leetcode -- Python
http://oj.leetcode.com/problems/longest-valid-parentheses/ 1 class Solution: 2 # @param s, a string 3 # @return an integer 4 def longestVa...
分类:编程语言   时间:2014-05-09 00:11:38    阅读次数:410
[BZOJ3568]DZY Loves Math VII
本人BZOJ的处女作。这题题面还是蛮有趣的吧。然后三个问题都蛮有意思的。要保证正确性,出数据还是异常蛋疼啊。本来各出三题的。但是考虑到是OJ上的题,就搞在一起了。这样代码量就会比较大。
分类:其他好文   时间:2014-05-08 23:47:58    阅读次数:846
LeetCode OJ - Subsets 1 && 2
这道题的做法,一定得掌握啊!!! elegant & beautiful & concise下面是AC代码: 1 /** 2 * Given a set of distinct integers, S, return all possible subsets. 3 * 这道...
分类:其他好文   时间:2014-05-08 22:44:57    阅读次数:424
LeetCode OJ - Restore IP Addresses
这道题采用穷举法。 1 /** 2 * Given a string containing only digits, 3 * restore it by returning all possible valid IP address combinations. 4 ...
分类:其他好文   时间:2014-05-08 09:17:22    阅读次数:248
SCAU-OJ 8596 最长上升子序列
时间限制:300MS 内存限制:1000K提交次数:255 通过次数:118题型: 编程题语言: 无限制DescriptionA numeric sequence of ai is ordered if a1 a[j],j大于等于1且小于i,i>1;(3)f(i) = 1 当对任意j,(j大于等于1...
分类:其他好文   时间:2014-05-08 06:18:11    阅读次数:682
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!