Leetcode Weekly contest 355 - Easy - Split Strings by Separator

preview_player
Показать описание
In this video we discuss the first problem of Leetcode Weekly contest 355

Рекомендации по теме
Комментарии
Автор

Since the separator is a special character, you just have to append "//".

Here is the code which worked perfectly for me.

List<String> ans = new ArrayList<>();

for(String word : words){
String[] arrString =

for(String ele : arrString){
if(ele!=""){
ans.add(ele);
}
}
}
return ans;

saswatamukherjee
Автор

Sir, split was not working here for java

Deepak-lcuu
Автор

This question wasted 15 minutes in contest

Deepak-lcuu
Автор

I tried so hard to have String.split() work ;( I ended up just doing it manually like this

patuitar
join shbcf.ru