Skip to content

Commit 4295584

Browse files
authored
Merge pull request #923 from beingshub02/patch-3
Create maximum_number_of_words_found_in_sentences.java
2 parents 648faab + a555050 commit 4295584

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class Solution {
2+
public int mostWordsFound(String[] sentences) {
3+
int max=0;
4+
String []s = new String[sentences.length];
5+
for(int i=0;i<sentences.length;i++)
6+
s[i] = sentences[i];
7+
8+
for(int i=0;i<sentences.length;i++){
9+
String []p = s[i].split(" ");
10+
if(max<p.length){
11+
max = p.length;
12+
}
13+
}
14+
return max;
15+
}
16+
}
17+
Footer

0 commit comments

Comments
 (0)