Skip to content
This repository has been archived by the owner on Feb 14, 2023. It is now read-only.

17.13. 恢复空格 https://leetcode-cn.com/problems/re-space-lcci/ #18

Open
AmelloAster opened this issue Jul 9, 2020 · 0 comments
Open
Labels
Leetcode daily topic 每日药丸 Middle 哥布林 金金 Code is life

Comments

@AmelloAster
Copy link
Collaborator

AmelloAster commented Jul 9, 2020

题目

哦,不!你不小心把一个长篇文章中的空格、标点都删掉了,并且大写也弄成了小写。像句子"I reset the computer. It still didn’t boot!"已经变成了"iresetthecomputeritstilldidntboot"。在处理标点符号和大小写之前,你得先把它断成词语。当然了,你有一本厚厚的词典dictionary,不过,有些词没在词典里。假设文章用sentence表示,设计一个算法,把文章断开,要求未识别的字符最少,返回未识别的字符数。

注意:本题相对原题稍作改动,只需返回未识别的字符数

示例

输入:
dictionary = ["looked","just","like","her","brother"]
sentence = "jesslookedjustliketimherbrother"
输出: 7
解释: 断句后为"jess looked just like tim her brother",共7个未识别字符。

解题代码

代码效率

解题思路

@AmelloAster AmelloAster added 金金 Code is life Leetcode daily topic 每日药丸 Middle 哥布林 labels Jul 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Leetcode daily topic 每日药丸 Middle 哥布林 金金 Code is life
Projects
None yet
Development

No branches or pull requests

1 participant