当前位置:网站首页>2022.7.7-----leetcode.648
2022.7.7-----leetcode.648
2022-07-07 21:53:00 【路Lu727】
public String replaceWords(List<String> dictionary, String sentence) {
String[] ss=sentence.split(" ");
int n=ss.length;
for(int i=0;i<n;i++){
for(String dic:dictionary){
if(ss[i].startsWith(dic))
ss[i]=dic;
}
}
String ans="";
for(int i=0;i<n;i++){
ans+=ss[i];
if(i!=n-1)
ans+=" ";
}
return ans;
}边栏推荐
- B_ QuRT_ User_ Guide(40)
- Take you hand in hand to build Eureka client with idea
- Markdown
- Home appliance industry channel business collaboration system solution: help home appliance enterprises quickly realize the Internet of channels
- The for loop realizes 1-100 addition and eliminates the 4-digit tail number
- codeforces每日5题(均1500)-第八天
- 二叉排序树【BST】——创建、查找、删除、输出
- 通达信买基金安全吗?
- MongoDB快速入门
- Reverse output three digit and arithmetic sequence
猜你喜欢

平衡二叉树【AVL树】——插入、删除

B / Qurt Utilisateur Guide (36)

Open source hardware small project: anxinco esp-c3f control ws2812

C simple question one

Anxin vb01 offline voice module access intelligent curtain guidance
postgis学习

S2b2b mall solution of intelligent supply chain in packaging industry: opening up a new ecosystem of e-commerce consumption

List. How to achieve ascending and descending sort() 2020.8.6

Interface

Flash encryption process and implementation of esp32
随机推荐
平衡二叉树【AVL树】——插入、删除
B / Qurt Utilisateur Guide (36)
【路径规划】使用垂距限值法与贝塞尔优化A星路径
Mobile heterogeneous computing technology - GPU OpenCL programming (basic)
0-1背包问题
KeePass realizes automatic input of web pages
Where are you going
B_ QuRT_ User_ Guide(40)
May day d-light
USB (XVII) 2022-04-15
Anxinco esp32-a1s development board is adapted to Baidu dueros routine to realize online voice function
Sequence of entity layer, Dao layer, service layer and controller layer
How to change the formula picture in the paper directly into the formula in word
0-1 knapsack problem
As a new force, chenglian premium products was initially injected, and the shares of relevant listed companies rose 150% in response
ASP. Net core middleware request processing pipeline
Take you hand in hand to build feign with idea
Anxin can internally test offline voice module vb-01 to communicate with esp-c3-12f
postgres timestamp转人眼时间字符串或者毫秒值
Given an array, such as [7864, 284, 347, 7732, 8498], now you need to splice the numbers in the array to return the "largest possible number."