2114. 句子中的最多单词数
为保证权益,题目请参考 2114. 句子中的最多单词数(From LeetCode).
解决方案1
Python
python
# 5946. 句子中的最多单词数
# https://leetcode-cn.com/problems/maximum-number-of-words-found-in-sentences/
from typing import List
class Solution:
def mostWordsFound(self, sentences: List[str]) -> int:
max_len = 0
for sentence in sentences:
max_len = max(max_len, len(sentence.split(" ")))
return max_len
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12