由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - How to solve this problem?
相关主题
How to design google search suggestion?问一下prefix tree (trie) 的题目
Glassdoor上面看到一道F家最近的面试题,来讨论一下?Bloomberg 一道题
问2道面试题G onsite 被据,郁闷....发个题目,估计就死在这上面了..
再来一道题新鲜onsite面经
一道MS题那个 google hint words 的老题
贴点面试题尘埃落定里的两道题
finds all repeated substrings in the string --- YAHOO interview question什么时候用SUFFIX TREE,什么时候用TRIE
这里牛人多,给大家来个算法的问题Amazon telephone interview
相关话题的讨论汇总
话题: solve话题: problem话题: acd话题: string话题: dfe
进入JobHunting版参与讨论
1 (共1页)
j***t
发帖数: 50
1
How to solve this problem? what algorithm should be used?
For a list of strings, find the largest subsets, within it, no string is a
prefix of another one.
For example,
a, abc, acd, df, dfe
The largets sub sets would be (both are of size 3):
abc, acd, def
or
abc acd, dfe
x******3
发帖数: 245
2
把所有string放在一个trie里,用一个sentinel作trie的根节点
然后把所有叶子拿出来,就是要的解
B*****t
发帖数: 335
3
how about topological sort

string is a

【在 j***t 的大作中提到】
: How to solve this problem? what algorithm should be used?
: For a list of strings, find the largest subsets, within it, no string is a
: prefix of another one.
: For example,
: a, abc, acd, df, dfe
: The largets sub sets would be (both are of size 3):
: abc, acd, def
: or
: abc acd, dfe
:

l*******e
发帖数: 309
4
可不可以按字典顺序先排个序 然后扫描一次?
x******3
发帖数: 245
5
每个字母作一个节点吗

【在 B*****t 的大作中提到】
: how about topological sort
:
: string is a

B*****t
发帖数: 335
6
每个单词作一个节点

【在 x******3 的大作中提到】
: 每个字母作一个节点吗
x******3
发帖数: 245
7
具体说下吧,不是很理解怎么用

【在 B*****t 的大作中提到】
: 每个单词作一个节点
B*****t
发帖数: 335
8
1. 删除重复字串.
2. 建立一个DAG,比如, 如果两个单词有prefix的关系的话,建立一条有向边。
3. 统计入度为0的节点。
建图的时候可以先sort一下,worst case复杂度O(n^2)

【在 x******3 的大作中提到】
: 具体说下吧,不是很理解怎么用
B*****i
发帖数: 831
9
within the subset no string is the prefix of another one
是不是要先找一下weakly connected component,然后分别取最大的那部分啊?
B*****t
发帖数: 335
10
突然发现一点儿问题

string is a
===================================
这里的def是怎么来的?!!!
===================================

【在 j***t 的大作中提到】
: How to solve this problem? what algorithm should be used?
: For a list of strings, find the largest subsets, within it, no string is a
: prefix of another one.
: For example,
: a, abc, acd, df, dfe
: The largets sub sets would be (both are of size 3):
: abc, acd, def
: or
: abc acd, dfe
:

k*n
发帖数: 150
11
cool!

【在 x******3 的大作中提到】
: 把所有string放在一个trie里,用一个sentinel作trie的根节点
: 然后把所有叶子拿出来,就是要的解

1 (共1页)
进入JobHunting版参与讨论
相关主题
Amazon telephone interview一道MS题
问个google老题的最佳解法贴点面试题
有向图判断有无环finds all repeated substrings in the string --- YAHOO interview question
最近面试碰到的题目这里牛人多,给大家来个算法的问题
How to design google search suggestion?问一下prefix tree (trie) 的题目
Glassdoor上面看到一道F家最近的面试题,来讨论一下?Bloomberg 一道题
问2道面试题G onsite 被据,郁闷....发个题目,估计就死在这上面了..
再来一道题新鲜onsite面经
相关话题的讨论汇总
话题: solve话题: problem话题: acd话题: string话题: dfe