当前位置:网站首页>No, just stick to it for 59 days
No, just stick to it for 59 days
2022-07-29 04:16:00 【A little Ming】

class Solution {
public String replaceWords(List<String> dictionary, String sentence) {
Set<String> dictionarySet = new HashSet<String>();
for (String root : dictionary) {
dictionarySet.add(root);
}
String[] words = sentence.split(" ");
for (int i = 0; i < words.length; i++) {
String word = words[i];
for (int j = 0; j < word.length(); j++) {
if (dictionarySet.contains(word.substring(0, 1 + j))) {
words[i] = word.substring(0, 1 + j);
break;
}
}
}
return String.join(" ", words);
}
}
边栏推荐
- %s. %c, character constant, string constant, const char*, pointer array, string array summary
- "Weilai Cup" 2022 Niuke summer multi school training camp 2H
- C语言力扣第61题之旋转链表。双端队列与构造循环链表
- [material delivery UAV] record (ROS + Px4 + yolov5 + esp8266 + steering gear)
- Fu Yingna: Yuan universe is the new generation of Internet!
- Change the value of the argument by address through malloc and pointer
- Methods of using multiple deformations on an element
- Don't the JDBC SQL connector of the big guys Flink now support all databases, such as vertica?
- Compilation and linking
- 不会就坚持64天吧 查找插入位置
猜你喜欢

SVG--loading动画

全屋WiFi方案:Mesh路由器组网和AC+AP

Problems encountered in vscode connection SSH

Design of environment detection system based on STM32 and Alibaba cloud

MySQL gets the maximum value record by field grouping

不会就坚持61天吧 最短的单词编码

Is the array name a pointer

UnicodeDecodeError: ‘ascii‘ codec can‘t decode byte 0x90 in position 614: ordinal not in range(128)

不会就坚持68天吧 狒狒吃香蕉

你真的会写Restful API吗?
随机推荐
Problems encountered in vscode connection SSH
Wechat applet parameter transfer
淘宝商品详情接口(商品详情页面数据接口)
C语言:联合体知识点总结
12.优先级队列和惰性队列
Lua language (stm32+2g/4g module) and C language (stm32+esp8266) methods of extracting relevant data from strings - collation
openFeign异步调用问题
11.备份交换机
请问,在sql client中,执行insert into select from job时,如何单
C语言:枚举知识点总结
Applet: Area scrolling, pull-down refresh, pull-up load more
SQL time fuzzy query datediff() function
What the hell is this error? It doesn't affect the execution result, but it always reports errors when executing SQL... Connecting maxcomputer uses
不会就坚持66天吧 权重生成随机数
Jenkins 参数化构建中 各参数介绍与示例
信号处理中的反傅里叶变换(IFFT)原理
不会就坚持65天吧 只出现一次的数字
%s. %c, character constant, string constant, const char*, pointer array, string array summary
不会就坚持67天吧 平方根
10.回退消息