当前位置:网站首页>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;
}
边栏推荐
猜你喜欢
关于CH32库函数与STM32库函数的区别
平衡二叉樹【AVL樹】——插入、删除
The efficient s2b2c e-commerce system helps electronic material enterprises improve their adaptability in this way
Extended tree (I) - graphic analysis and C language implementation
进度播报|广州地铁七号线全线29台盾构机全部完成始发
The file format and extension of XLS do not match
Markdown
激光slam学习(2D/3D、偏实践)
C method question 1
Learn about scratch
随机推荐
企业应用需求导向开发之人力部门,员工考勤记录和实发工资业务程序案例
Flash encryption process and implementation of esp32
通达信买基金安全吗?
Take you hand in hand to build Eureka server with idea
Ora-02437 failed to verify the primary key violation
Extended tree (I) - graphic analysis and C language implementation
C number of words, plus ¥, longest word, average value
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."
Anxin can internally test offline voice module vb-01 to communicate with esp-c3-12f
MongoDB快速入门
[untitled]
B_ QuRT_ User_ Guide(40)
FPGA basics catalog
The file format and extension of XLS do not match
[summary] some panels and videos seen
postgres timestamp转人眼时间字符串或者毫秒值
One of the anti climbing methods
SAP HR labor contract information 0016
SQL database execution problems
[stm32+esp8266 connects to Tencent cloud IOT development platform 3] stm32+esp8266-01s dynamically registers devices on Tencent cloud (at instruction mode) -- with source code