your explanation is on next level 🔥🔥... and your final thoughts is really helpful thank u so much..
@user-pt3fp8nt7e
6 ай бұрын
thanks for the tutorial teacher
@udayrajvadeghar8555
5 ай бұрын
thank you sir : )
@ankitgupta9272
4 ай бұрын
Please make a playlist, so i can solve all these type of question at first and then watch your video if i got stuck
@mohammadsalim2397
9 ай бұрын
Thanks, bro, but I didn't understand why you started the second loop with 'i=k' (we only need to increment 'i' once). Let's say, for example, k=3; at that point, we don't check the values 0 and 1. Also, why should the condition be 'i
@jritzeku
8 ай бұрын
First loop populates our first window which is 'k' length. In second loop he is resuming loop from where we left off in first loop so we start at 'k'. I think we could have done this all in one loop tho.
@nikoo28
8 ай бұрын
I didn’t understand your question.
@saikiran1426
5 ай бұрын
May be Elements of the array are contiguous .but string is also a char array,so,i think elements in the string also contiguous
@AngelOfDeath943
Жыл бұрын
Initially I used string to store aeiou then use string contains method to check if vowels are there or not , so iam guessing this check takes longer time than looking in Hashset
@nikoo28
10 ай бұрын
Hashset is the fastest
@SubhajitDas-mt7sn
2 ай бұрын
cpp class Solution { public: int maxVowels(string s, int k) { unordered_set vowel = {'a', 'e', 'i', 'o', 'u'}; int Max_vowel = 0; int Window_vowel = 0; for (int i = 0; i < k; i++) { if (vowel.count(s[i])) { Window_vowel++; } } Max_vowel = Window_vowel; for (int i = k; i < s.size(); i++) { if (vowel.count(s[i - k])) { Window_vowel--; } if (vowel.count(s[i])) { Window_vowel++; } Max_vowel = max(Max_vowel, Window_vowel); } return Max_vowel; } };
Пікірлер: 14