j****n 发帖数: 4358 | 1 【 以下文字转载自 JobHunting 讨论区 】
发信人: Solow (Solow), 信区: JobHunting
标 题: L家第一轮店面 被烙印黑了
发信站: BBS 未名空间站 (Mon Feb 23 16:58:15 2015, 美东)
前面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' | a**********t 发帖数: 631 | 2 是不是想太复杂了?难倒不是一简单的counting sort吗? |
|