Redian新闻
>
Citi Hhonors 出sears10% offer了
avatar
Citi Hhonors 出sears10% offer了# Money - 海外理财
b*d
1
一个公司发的。感觉不容易。
-------------------------
Save Humanity(30points)
Oh!! The mankind is in trouble again.This time its a deadly disease
spreading with rate never seen before. Efficient detectors for the virus
responsible is the need of hour. You being the lead at Central Hospital need
to find a fast and reliable way to detect the 'foot-prints' of virus DNA in
that of patient.
The DNA of patient as well as of virus consist of lower case letters. Since
the data collected is raw there might be some errors.So you need to find all
substrings in the patient DNA that exactly matches the virus DNA with
exception of one at most one mismatch.
For example tolerating at most one mismatch, "aa" and "aa" are matching, "ab
" and "aa" are matching, while "ab" and "ba" are not.
Input:
The first line contains the number of test cases T. T cases follow. Each
case contains two lines containing strings P(Patient DNA) and V(Virus DNA) .
Each case is followed by a blank line.
Output:
Output T lines, one corresponding to each case. For each case, output a
space delimited list of starting indices (0 indexed) of substrings of P
which are matching with V according to the condition mentioned above . The
indices has to be in increasing order.
Constraints:
1 <= T <= 10
P and V contain at most 100000 characters each.
All characters in P and V are lowercase letters.
Sample Input:
3
abbab
ba
hello
world
banana
nan
Sample Output:
1 2
0 2
Explanation:
For the first case, the substrings of P starting at indices 1 and 2 are "bb"
and "ba" and they are matching with the string V which is "ba".
For the second case, there are no matching substrings so the output is a
blank line.
Download sample testcases as zip ['Compile & Test' will run your code
against these testcases. Avoid using Notepad for viewing these testcases]
avatar
a*1
2
需要加,另外starbucks20%
avatar
d*b
3
解决这个问题不难,难的是一个高效的算法。
avatar
u*n
4
Good, 撸 VGC去
avatar
b*d
5

yes, I did some tricks but still several big tests can't pass.

【在 d******b 的大作中提到】
: 解决这个问题不难,难的是一个高效的算法。
avatar
C*d
6
这个在哪里加?
avatar
s*e
8
看到limit没?
avatar
b*e
9
对于每一个V和P,求V和reverse(V)的KMP。然后用KMP(V)从前向后扫一遍P,用KMP(
reverse(V))从后向前扫一遍P,几下所有partial match的起始。组后扫一遍所有
partial matches,看有没有能在一个点对上并且长度合适的。这样整个的算法是线性
的。

【在 b*******d 的大作中提到】
:
: yes, I did some tricks but still several big tests can't pass.

avatar
l*h
10
同问

【在 C*******d 的大作中提到】
: 这个在哪里加?
avatar
m*e
11
这卡开了就没怎么log in过, 找不到login界面了😓
avatar
o*g
12
sears那个最多给35刀,咖啡那个最多才4刀。

【在 u***n 的大作中提到】
: Good, 撸 VGC去
avatar
u*n
13
很不错了,sears也就是200最大面值,喝bestbuy一个水平 20-5.95 =14 刀赚头

【在 o*****g 的大作中提到】
: sears那个最多给35刀,咖啡那个最多才4刀。
avatar
J*X
14
yes,it's so lame.

【在 o*****g 的大作中提到】
: sears那个最多给35刀,咖啡那个最多才4刀。
avatar
f*s
15
citi的卡只有dividend有offer

【在 a*******1 的大作中提到】
: 需要加,另外starbucks20%
avatar
w*c
16
毛都没有
avatar
o*g
17
嗯,这样看确实不错。

【在 u***n 的大作中提到】
: 很不错了,sears也就是200最大面值,喝bestbuy一个水平 20-5.95 =14 刀赚头
avatar
C*e
18
难道不是买两张?35-12=23

【在 u***n 的大作中提到】
: 很不错了,sears也就是200最大面值,喝bestbuy一个水平 20-5.95 =14 刀赚头
avatar
u*n
19
恩,有道理,反正跑一次,都撸出来

【在 C********e 的大作中提到】
: 难道不是买两张?35-12=23
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。