码迷,mamicode.com
首页 >  
搜索关键字:字符    ( 139669个结果
[LeetCode] Palindrome Partition [11]
题目:Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. 解题思路: 回文划分,题目意思是给一个字符串,找出将字符串划分为一系列回文子串的各种可能组合。例如,一个子串“aab“,你需要返回["aa","b"],["a","a","b"]。这个题目的解法也是非常的典型---循环加递归,...
分类:其他好文   时间:2014-06-09 23:24:11    阅读次数:256
探秘VB.net中的shared与static
在编程的过程中,经常需要共享一些数据,如我们在开发机房收费系统中用到的“单价”,与数据库连接的字符串等等,都需要共享。...
分类:Web程序   时间:2014-06-09 23:10:06    阅读次数:312
poj 1699 Best Sequence(dfs)
http://poj.org/problem?id=1699 题意:给出n个只含A,C,G,T的字符串,要求能把这n个字符串组合起来的最短长度。 思路:预处理一下,a[i][j]表示将第j个字符串连接到第i个字符串后面增加的长度,那么我们需要找出这样一个序列1,2....n满足a[1][2] + a[2][3] + ...+a[n-1][n]的最小值。DFS就OK了,任选一个字...
分类:其他好文   时间:2014-06-08 17:49:21    阅读次数:199
[LeetCode] Valid Palindrome [10]
题目:For example,"A man, a plan, a canal: Panama" is a palindrome. "race a car" is not a palindrome. 解题思路:验证一个字符串是否是回文字符串。首先看看wiki上对于回文的解释:回文,亦称回环,是正读反读都能读通的句子,亦有将文字排列成圆圈者,Famous examples include "Amore, Roma", "A man, a plan, a canal: Panama" and "No 'x' in...
分类:其他好文   时间:2014-06-08 16:30:29    阅读次数:235
leetcode——Longest Substring Without Repeating Characters 求链表中无重复字符的最大字串长度(AC)
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. Fo...
分类:其他好文   时间:2014-06-08 16:27:47    阅读次数:231
普林斯顿公开课 算法3-9:Comparator比较器
在前几个章节中使用了Comparable作为比较函数。比如对于字符串,就是按字母表的顺序进行排序。有时候想要换一种比较方式,该怎么实现呢? 在Java中可以使用Comparator比较器,以下代码展示了字符串之间不同的比较方式。 String[] a; ... Arrays.sort(); ... Arrays.sort(a, String.CASE_INSENSITI...
分类:其他好文   时间:2014-06-08 15:37:08    阅读次数:201
leetcode——Reverse Words in a String 旋转字符串中单词顺序(AC)
题目如下: Given an input string, reverse the string word by word. For example, Given s = "the sky is blue", return "blue is sky the". click to show clarification. Clarification: What co...
分类:其他好文   时间:2014-06-08 14:58:13    阅读次数:231
[LeetCode] Palindrome Partitioning II [12]
题目:For example, given s = "aab", Return 1 since the palindrome partitioning ["aa","b"] could be produced using 1 cut 解题思路:给一个字符串,如果字符串可以划分成若干子回文字符串,返回最小的划分数量。 这个题如果还用之前求所有划分组合的循环加递归方法的话,就会得到超时的错误。这是就要考虑别的方法,动态规划倒是一个不错的方法,但是动态规划最重要的是要找到动态方程。本题的动态方程: dp[i] =...
分类:其他好文   时间:2014-06-08 14:56:58    阅读次数:257
循环节
循环节 Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 X最近爱上了一种奇怪的游戏,就是找出一个字符串中的最小循环节。 对于最小循环节的定义:对于字符串A存在字串B,使得A是由N个完整的B组成的,那么B就是A的一个循环节,长度最小的那一个为最小循环节。 输入 多组输入。 每组输入一个字符...
分类:其他好文   时间:2014-06-08 09:55:32    阅读次数:174
2014年6月6日--华为机试
华为机试题目,看看有没有好的解法...
分类:其他好文   时间:2014-06-08 08:29:15    阅读次数:232
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!