由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 问一道字符串相关的题目。
相关主题
字典里面如何快速找到一个单词对应的只有一个字母不同的单词amazon 面筋题怎么做?
机器狗用BFS或者DFS把所有棋步都列举出来 (转载)word search follow up的问题
转划单词题的优解google 电话面试题
再问一道老题请教个面试题
问一个word ladder的题目LeetCode: Word Ladder
edit distance vs. word ladder这个题目能否半小时完成coding?
leetcode wordladder2 求助!(solved)tic tac toe程序是什么难度水平
一道Facebook面经难题问两道字符串的题
相关话题的讨论汇总
话题: word话题: dictionary话题: bfs话题: source话题: step
进入JobHunting版参与讨论
1 (共1页)
r****o
发帖数: 1950
1
以前的老题。
是不是要用到DFS/BFS啊?
有简单的方法吗?
Given a source word, a target word, and a dictionary, how to transform the
source word into target word by changing only one letter in each step. The
word you get in each step must be in the dictionary.
p*****e
发帖数: 1611
2
如果word短,dic很大的话,就穷举+hash+bfs

【在 r****o 的大作中提到】
: 以前的老题。
: 是不是要用到DFS/BFS啊?
: 有简单的方法吗?
: Given a source word, a target word, and a dictionary, how to transform the
: source word into target word by changing only one letter in each step. The
: word you get in each step must be in the dictionary.

r****o
发帖数: 1950
3
为什么bfs还要用穷举呢?

【在 p*****e 的大作中提到】
: 如果word短,dic很大的话,就穷举+hash+bfs
p*****e
发帖数: 1611
4
bfs的方式穷举。
你大概明白意思就好了~
这题关键是如果dic非常大,如果直接在dic上建图,是没法做的

【在 r****o 的大作中提到】
: 为什么bfs还要用穷举呢?
f**r
发帖数: 865
5
Should we consider the following case, for e.g.: the dictionary contains 3
source word: boa
destination word: bbb
dictionary: boa, bbb, cbb, cob, coa
In this case, boa -> bbb cannot be achieved without changing the first
character (which were originally the same). It almost seems like some DP is
needed, or am I complicating things?
What is the tree that you guys search with BFS?
1 (共1页)
进入JobHunting版参与讨论
相关主题
问两道字符串的题问一个word ladder的题目
Depth-first search是否属于动态规划?edit distance vs. word ladder
图的最小生成树问题leetcode wordladder2 求助!(solved)
问个题: 在1..N中, 所有K个数字组合中的第P个一道Facebook面经难题
字典里面如何快速找到一个单词对应的只有一个字母不同的单词amazon 面筋题怎么做?
机器狗用BFS或者DFS把所有棋步都列举出来 (转载)word search follow up的问题
转划单词题的优解google 电话面试题
再问一道老题请教个面试题
相关话题的讨论汇总
话题: word话题: dictionary话题: bfs话题: source话题: step