Common WordsLet's continue examining words. You are given two string with words separated by commas. Try to find what is common between these strings....
分类:
其他好文 时间:
2014-08-05 10:54:19
阅读次数:
190
对于数组s[0~n-1],计算next[0~n](多计算一位)。
考虑next[n],假设t=n-next[n],如果n%t==0,则t就是问题的解,否则解为1。
这样考虑:
比如字符串"abababab",
a b a b a b a b *
next -1 0 1 2 3 4 5 6 7
考虑这样的模式匹配,将"ababa...
分类:
其他好文 时间:
2014-08-04 21:38:08
阅读次数:
294
题目:Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-....
分类:
编程语言 时间:
2014-08-04 13:58:57
阅读次数:
285
题目:Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".题解:二进制加法都是从最低位(从右加到左)。所以对两个字符串要从最后一位开始加,....
分类:
编程语言 时间:
2014-08-04 06:13:36
阅读次数:
291
Big String
Time Limit: 2 Seconds Memory Limit: 65536 KB
We will construct an infinitely long string from two short strings: A = "^__^" (four characters), and B = "T.T" (three characters). R...
分类:
其他好文 时间:
2014-08-02 21:02:04
阅读次数:
291
Zipper
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 6491 Accepted Submission(s): 2341
Problem Description
Given three strings...
分类:
其他好文 时间:
2014-08-02 21:01:44
阅读次数:
297
UVA 10298 - Power Strings
题目链接
题意:本意其实就是,给定一个字符串,求出最小循环节需要几次循环出原字符串
思路:利用KMP中next数组的性质,n - next[n]就是最小循环节,然后n / 循环节就是答案
代码:
#include
#include
const int N = 1000005;
char str[N];
int ...
分类:
其他好文 时间:
2014-08-02 18:21:43
阅读次数:
282
Match for Bonus
Time Limit: 2 Seconds Memory Limit: 65536 KB
Roy played a game with his roommates the other day.
His roommates wrote 2 strings of characters, and gave each character a b...
分类:
其他好文 时间:
2014-08-02 18:20:33
阅读次数:
256
In this challenge you need to print the data that accompanies each integer in a list. In addition, if two strings have the same integers, you need to ...
分类:
其他好文 时间:
2014-08-01 22:40:42
阅读次数:
323
AnagramsGiven an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.编程珠玑中的一道题,书中的解法很巧妙,我就直接搬来用了,时...
分类:
其他好文 时间:
2014-08-01 22:37:32
阅读次数:
162