Detect Capital | LeetCode 520 | C++, Java, Python

preview_player
Показать описание

**** Best Books For Data Structures & Algorithms for Interviews:**********
*****************************************************************************

August LeetCoding Challenge | Problem 1 [Free] | Detect Capital | 1 August,
Facebook Coding Interview question,
google coding interview question,
leetcode,
Detect Capital,
Detect Capital c++,
Detect Capital Java,
Detect Capital python,
Detect Capital solution,
520. Detect Capital,

#CodingInterview #LeetCode #JulyLeetCodingChallenge #Google #Amazon #DetectCapital
Рекомендации по теме
Комментарии
Автор

The pace at which you are going, you are going to cover the whole leetcode

raviashwin
Автор

You actually did a video on this one :O

crankyinmv
Автор

class Solution {
public:
bool detectCapitalUse(string word) {
int n = word.size();
int c=0;
for(int i=0;i<n;i++)
{
if(word[i]>='A' && word[i]<='Z')
c++;
}
if(c==n || c==0 || (c==1 && word[0]>='A' && word[0]<='Z'))
return true;
else
return false;
}
};
Time -O(n)
Space-O(1)

sehajverma
visit shbcf.ru