Maximum Number of Words Found in Sentences LeetCode solution in Java

1
class Solution {
2
public int mostWordsFound(String[] sentences) {
3
int max = 0;
4
for (int i = 0; i < sentences.length; i++) {
5
max = Math.max(max, (sentences[i].split(" ")).length);
6
}
7
return max;
8
}
9
}

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0