Detect Capital | Leetcode 520 | String

preview_player
Показать описание
Time Complexity : O(n)
Space Complexity : O(1)


Please like, share and subscribe if you found the video useful. Feel free to ask in comments section if you have any doubts. :)

#DataStructuresAndAlgorithms
#LoveBabbarDSASheet
#interviewpreparation
Detect Capital solution
Detect Capital Leetcode
Detect Capital C++
Detect Capital Java
Detect Capital Python

🔥🔥🔥🔥👇👇👇

Checkout the series: 🔥🔥🔥
LIKE | SHARE | SUBSCRIBE 🔥🔥😊
Рекомендации по теме
Комментарии
Автор

Thanks a lot Diii!

class Solution {
public boolean detectCapitalUse(String word) {
int n=word.length();
int count=0;
for(int i=0;i<n;i++){

count++;
}
}
if(count==n){
return true;

}
if(count==0){
return true;
}
&& count==1){
return true;
}



return false;


}
}

// new one comment like all
// this is also simple approach in java

pavanrajjagdale
Автор

class Solution {
public boolean detectCapitalUse(String word) {
int counter=0;
for(int i = 0;i<word.length();i++){
if
counter++;
}
return counter==0 || counter==word.length() || counter==1 &&

}
}

Simple approach in Java

techkibaat
Автор

If possible can you please make a video on leetcode question 542. ( 01 Matrix ) i am finding it hard to solve Thank you!!

artsysoul
Автор

How to break big problem into smaller sub problem, can u plz explain with example

AjithKumaR-jwwt
Автор

I really appreciate the kind of effort you put in explaining the approach (it really helps and even medium and hard problem looks easy). Keep up the good work.

intezaralam
Автор

Recently i am taking help from one of your video in minimum number of jumps problem 450 sheet wali playlist i come to know about greedy algorithm can u make video on this what actually greedy algorithm is and how to identify it and implement it
Thanks though your explanation was crystal clear.

ANUJ-wesu
Автор

I’m confused between Tutort, Bosscoder and scaler. Do you think we need to join these academies for cracking Interviews?

deshbhakt
Автор

I was expecting that there will be a recursive approach. But iterative have done

hemanthpabbathi
Автор

Fully understood as always!!! please make also some string with backtracking related videos or video on hard topics

ankitghosh
Автор

Is there any what's app groups. For your followers

hemanthpabbathi
Автор

mam could you please answer one question i ask to you linkedlin

shivammishrasvnit
Автор

Thank You for being so consistent ✌💥...

I got this in less than a min, but by taking count val and simultaneously
bool detectCapitalUse(string word) {
int n=word.size();
int count=0;
for(int i=0;i<n;i++)
{
if(isupper(word[i]))
{
count++;
}
}
if(count==0)
return true;
if(isupper(word[0]) && count==1)
return true;
if(count == n)
return true;
return false;
}

ecs_shaileshbharti
join shbcf.ru