Maximum Number of Words Found in Sentences LeetCode solution in JavaScript

1
/**
2
* @param {string[]} sentences
3
* @return {number}
4
*/
5
var mostWordsFound = function (sentences) {
6
let max = 0;
7
let temp = 0;
8
for (let i = 0; i < sentences.length; i++) {
9
temp = sentences[i].split(" ").length;
10
if (temp > max) {
11
max = temp;
12
}
13
}
14

15
return max;
16
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0