Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

2114. Maximum Number of Words Found in Sentences leetcode solution in c++

class Solution {
public:
    int mostWordsFound(vector<string>& sentences) {
        long countr=0;
        for(int i=0;i<sentences.size();i++)
        {
            countr=max(countr,count(sentences[i].begin(),sentences[i].end(),' '));
        }
        return countr+1;
    }
};
Source by www.codegrepper.com #
 
PREVIOUS NEXT
Tagged: #Maximum #Number #Words #Found #Sentences #leetcode #solution
ADD COMMENT
Topic
Name
3+8 =