Skip to content

Commit 98def03

Browse files
authored
Create Maximum Number of Words Found in Sentences.java
1 parent 8219429 commit 98def03

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class Solution {
2+
public int mostWordsFound(String[] sentences) {
3+
return Arrays.stream(sentences).map(sentence -> sentence.split("\\s").length)
4+
.max(Integer::compare).orElse(0);
5+
}
6+
}

0 commit comments

Comments
 (0)