大颂我又去了趟大峡谷# pets - 心有所宠
S*w
1 楼
前面30分钟抓着问了我过去的经历,
做了一个小题目。
然后扔出这个大题 要求O(n)
且输出排序
我先用suffix array, 说不好
然后用hashmap, o(n), 但是输出不排行
恶心的地方,
输入不是string,是流
输出要排序
O(N)
最可气的是 找不到他想要的算法 不让写代码,
最后5分钟,找到他想要的答案,来不及了
好苦啊 为啥大家店面就那几道题,给我这么难的一个
This problem pertains to the field of bioinformatics, but it does not
require any specialized biological knowledge. All DNA is composed of
sequences of four "letters" of nucleotides, whose abbreviations are A, C, G,
and T, strung together, for example: "AAGATCCGTC". A typical chromosome (a
very long DNA molecule) may have several millions of these letters strung
together. When studying DNA, it is sometimes useful to know when a
particular sequence of letters is repeated.
For this problem, we would like to identify all the 10-letter-long
sequences that occur more than once in any given chromosome. Write a
program that prints out all such sequences to the standard output stream,
sorted in alphabetical order. Start with this code:
*/
/*
SIMPLE EXAMPLE
Question: (simplified version of the problem) Find all 2 letter sequences
that appear more than once and print them out in sorted order.
Input: 'AAGATCCGTCAGTTTTCAAT'
Output: 'AA', 'AG', 'AT', 'CA', 'GT', 'TC', 'TT'
做了一个小题目。
然后扔出这个大题 要求O(n)
且输出排序
我先用suffix array, 说不好
然后用hashmap, o(n), 但是输出不排行
恶心的地方,
输入不是string,是流
输出要排序
O(N)
最可气的是 找不到他想要的算法 不让写代码,
最后5分钟,找到他想要的答案,来不及了
好苦啊 为啥大家店面就那几道题,给我这么难的一个
This problem pertains to the field of bioinformatics, but it does not
require any specialized biological knowledge. All DNA is composed of
sequences of four "letters" of nucleotides, whose abbreviations are A, C, G,
and T, strung together, for example: "AAGATCCGTC". A typical chromosome (a
very long DNA molecule) may have several millions of these letters strung
together. When studying DNA, it is sometimes useful to know when a
particular sequence of letters is repeated.
For this problem, we would like to identify all the 10-letter-long
sequences that occur more than once in any given chromosome. Write a
program that prints out all such sequences to the standard output stream,
sorted in alphabetical order. Start with this code:
*/
/*
SIMPLE EXAMPLE
Question: (simplified version of the problem) Find all 2 letter sequences
that appear more than once and print them out in sorted order.
Input: 'AAGATCCGTCAGTTTTCAAT'
Output: 'AA', 'AG', 'AT', 'CA', 'GT', 'TC', 'TT'