Maximum Number of Words Found in Sentences (Leetcode 2114)

Problem Link: https://leetcode.com/problems/maximum-number-of-words-found-in-sentences/

class Solution:
    def mostWordsFound(self, sentences: List[str]) -> int:
        
        ans=0
        for i in sentences:
            l=list(map(str,i.split(' ')))
            ans=max(ans,len(l))
        
        return ans

Last updated