由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 问个snapchat的面经题
相关主题
问个snapchat的面经题 二分检索的问一个word ladder的题目
问个snapchat的面经题dfs优化的题LeetCode: Word Ladder
问个snapchat的面经题 交朋友问一道题(10)
最后一道snapchat面经题,顺求blessleetcode 的two sum
问两道google题google 电面
google电面杯具,贡献题目问一个Google老题
转划单词题的优解编程习惯问题
一道G家店面题一道google interview的题目
相关话题的讨论汇总
话题: 单词话题: dog话题: word话题: given话题: dict
进入JobHunting版参与讨论
1 (共1页)
s*******m
发帖数: 228
1
leetcode原题word breakII,输出一种分割即可
Given a string s and a dictionary of words dict, add spaces in s to
construct a sentence where each word is a valid dictionary word.
Return all such possible sentences.
For example, given
s = "catsanddog",
dict = ["cat", "cats", "and", "sand", "dog"].
A solution is ["cats and dog", "cat sand dog"].
我考虑的做法是,先动态规划找到可分割的点dp[n+1],然后倒着遍历s,查找单词。
follow up: 英语中,几个字母组成单词的概率远小于不是单词的概率,怎么优化?
follow问题,该怎么优化????????????
e*******7
发帖数: 347
2
路过帮顶
b*****n
发帖数: 618
3
建个trie
s*******m
发帖数: 228
4
请详细讲讲啊

【在 b*****n 的大作中提到】
: 建个trie
b*********n
发帖数: 26
5
In your DP, you are caching the exist words,
you can cache the non exist words
1 (共1页)
进入JobHunting版参与讨论
相关主题
一道google interview的题目问两道google题
问个google面经题google电面杯具,贡献题目
问个google面试题转划单词题的优解
问个google面试题一道G家店面题
问个snapchat的面经题 二分检索的问一个word ladder的题目
问个snapchat的面经题dfs优化的题LeetCode: Word Ladder
问个snapchat的面经题 交朋友问一道题(10)
最后一道snapchat面经题,顺求blessleetcode 的two sum
相关话题的讨论汇总
话题: 单词话题: dog话题: word话题: given话题: dict