Lecture 41: Sliding Window Protocol on Strings

  Рет қаралды 37,320

Coder Army

Coder Army

Күн бұрын

Пікірлер: 150
@CoderArmy9
@CoderArmy9 Жыл бұрын
Coder Army, How's the Josh?
@SabyasachiGorai-g9t
@SabyasachiGorai-g9t Жыл бұрын
High sir 🔥
@goandget7945
@goandget7945 Жыл бұрын
Bhaiya I think you need to take some rest. I have seen that you are struggling with throat pain
@narutodihargo
@narutodihargo Жыл бұрын
High bhaiya
@prasanna9440
@prasanna9440 Жыл бұрын
High sir 🎉
@im_golu199
@im_golu199 Жыл бұрын
High Sir 😎
@sushantbhardwaj556
@sushantbhardwaj556 Жыл бұрын
Today Is Chaat puuja that's why I wake early 😅 and I attended this Lectures. ❤ Jai Chaati maayia . ❤😅😅
@shrivvlogs6045
@shrivvlogs6045 Жыл бұрын
​@@sohamjain8599itne jitne apke population ni h
@GoogleAccount-sm9hz
@GoogleAccount-sm9hz Жыл бұрын
​@sohamjain8599 consider this world to be a project then they are many people who contribute to this making of the project. Then consider each developer as a God. 😂
@sohamjain8599
@sohamjain8599 Жыл бұрын
@@GoogleAccount-sm9hz 👍🏼
@techforyou7518
@techforyou7518 5 ай бұрын
Ques -- 1 vector count(256, -1); int ans = 0, start = 0, end = 0; while(end < s.size()) { if(count[s[end]] != -1) { if(count[s[end]] >= start) start = count[s[end]] + 1; } count[s[end]] = end; ans = max(ans , (end-start+1)); end++; } return ans;
@anujrawat3058
@anujrawat3058 Жыл бұрын
Thanks bhaiya, you are the best teacher I have ever watched on KZbin for coding 😊 Your way of teaching is very defined and easy to understand
@universalmeditationmusic9299
@universalmeditationmusic9299 Жыл бұрын
Har din kuch new shikhne mil rah hi our ab coding bhi ashan ho Gaya hi ❤ thank you @coder army
@shahzaib3469
@shahzaib3469 Күн бұрын
amazing explanation !!! much love & respect from Pakistan.
@Pramod_saraswat001
@Pramod_saraswat001 Жыл бұрын
Bhai mene to abhi abhi aap se pdna start Kiya h Bhaiya m to app ke teaching style ka bhau bdaa fan ho chuka hu Kya pdate to aap Jese ek badaa bhai apne chote bhai ko pdaa rhaa ho (pure siddat k saath ) (Bina kese loobh lalach k) Thank you so much bhaiya Apna attitude essi trh ka rkhna App k ye Chote bhai aap ke mahanat ko Jaaya nhee jaane denge. hmm bhi tavad tood mahanat krenge aap k saath Aap jese bade Bhai mil jaaye to fir tnsn kis baat ke Bdee bhagyasali h hum coder army team k bande Jenhe aap jese bade Bhai ka saath Mila Thank you bhai ❤❤❤❤❤❤ You soo much
@gauravkheriwal9559
@gauravkheriwal9559 8 ай бұрын
love your dedication underateed tutor
@divyanshsharma673
@divyanshsharma673 Жыл бұрын
This man is always excited and consistent, he brings me motivation to stay hard over this series always 🌟🌟
@subhojit627
@subhojit627 Жыл бұрын
Motivated to do the lectures with consistency at 6 am❤
@joydeep-halder
@joydeep-halder Жыл бұрын
1:16:08 +1 nhi kiya q ki age wala while loop me second++ ho gya tha loop se bahar ate bakt.
@colabbro7789
@colabbro7789 9 ай бұрын
6:13 BrutForce Approach for the problem. i spend my 1 Hour on this problem to only find brute-force approach. #include using namespace std; #include int main() { string str="ababc"; //cout
@tiieej3950
@tiieej3950 3 ай бұрын
1: brute force class Solution{ public: int findSubString(string str) { // Your code goes here sets; for(auto i:str){ s.insert(i); } int ans=INT_MAX; for(int i=0;i
@dontreadmybanner2002
@dontreadmybanner2002 7 күн бұрын
Bro it's not similar to sir how explain but I think it will give ans
@Ajeetkumar-uo4hf
@Ajeetkumar-uo4hf Жыл бұрын
Bhai baap level ka explain karte ho. By far the best DSA course on youtube
@CHAUDHARY_PRAYAS
@CHAUDHARY_PRAYAS 11 ай бұрын
finally this video is completed after giving it 6-7 days.
@waniyafarooq8675
@waniyafarooq8675 3 ай бұрын
it means I am not the only one which take 4+ days to complete a video
@Billy-gd1rm
@Billy-gd1rm Ай бұрын
me completing this video in 1:30 hrs
@satyam6943
@satyam6943 Жыл бұрын
Bhailog jisko jisko coding seekhte rhna hai aur Jo abhi Tak consistent hai suno kya hum log ek group bana le jisme hum coding problem bhejenge agar humse solve nhi hota hai to group me daal denge aur jisko aata hai wo bata dega. Aur sath hi sath GFG weekly contest me hissa lenge ek sath kya bolte ho. 5 6 log like Karke reply do to grp banate hai
@vipulkumar1830
@vipulkumar1830 9 ай бұрын
Best Explaination in the world bhaiya
@architgupta6109
@architgupta6109 11 ай бұрын
hw question 3: Smallest window containing 0, 1 and 2 code : class Solution { public: int smallestSubstring(string s) { // Code here int first = 0 , second =0 , len = s.size(); int diff = 0; vector count(3,0); for(int i=0; i
@HETPLAYZ
@HETPLAYZ 3 ай бұрын
hw question :- 3 int smallestSubstring(string s) { // Code here vectorcount(3,0); int first=0,second=0,len=s.size(),diff=3; bool check=0; while(second
@GOATSOFFOOTBALL
@GOATSOFFOOTBALL 13 күн бұрын
completed ,revise the second problem code
@Samreen-sam12
@Samreen-sam12 3 ай бұрын
Bhaya love from uttarakhand ❤
@nitinduke
@nitinduke Жыл бұрын
37:55 in java class Solution { public int lengthOfLongestSubstring(String s) { boolean[] count = new boolean[256]; int first = 0, second = 0, len = 0; while (second < s.length()) { // Repeating character while (count[s.charAt(second)]) { count[s.charAt(first)] = false;//ascii value count array me change hogi first++; } count[s.charAt(second)] = true; len = Math.max(len, second - first + 1); second++; } return len; } }
@YogeshwarGupta-r3u
@YogeshwarGupta-r3u Жыл бұрын
Bhaiya ek baat bolu.....aap na next video se last me ye bhi bta diya kariye ki kal konsa topic padhayenge jisse hm log bi thoda dekh ke baithe rahenge aur padhte time usko relate karke aur achhse se samajh payenge.......isse hoga ye ki apne se padh kr jo hm galtiya kr sakte hai vo video dekhte time sudhar sake.....aur agar next video me sirf questions lagwane ho to ek do usse milta julta question hme description me de diya kariye jisse hm log bhi thoda hath pao mar le at least brute force ka logic bna paye.......hope aap ise consideration me lenge........Thank You for this beautiful Course 🙏❤
@HETPLAYZ
@HETPLAYZ 3 ай бұрын
hw question :- 4 int longestKSubstr(string s, int k) { // your code here int first=0,second=0,len=0; vectorcount(26,0); bool check=0; while(second
@saitanush9453
@saitanush9453 4 ай бұрын
Tq bhaiya, Aaj kuch naya seekha😄😄
@slouchysenpai1970
@slouchysenpai1970 2 ай бұрын
you explain everything in depth bhayya, u should have explained this also and then shouldve given homework
@RockyBahi70336
@RockyBahi70336 Жыл бұрын
Motivated to do the lectures with consistency at 6 am🍵🍵🍵
@abhinavparashar1934
@abhinavparashar1934 4 ай бұрын
Solution of 2nd question Smallest Distinct Window Code start from here :- #include #include using namespace std; int findSubString(string str) { vector count(256, 0); int diff = 0; for (int i = 0; i < str.size(); i++) { // string str="AABBBCBBAC"; found distinct characters. if (count[str[i]] == 0) { diff++; count[str[i]]++; } } fill(count.begin(), count.end(), 0); // for again making them zero int len = str.size(); int first = 0, second = 0; while (second < str.size()) { if (diff != 0) { if (count[str[second]] == 0) { count[str[second]]++; diff--; } else // if (count[str[second]]>=1) { count[str[second]]++; } } if (diff == 0) { while (diff == 0) { count[str[first]]--; if (count[str[first]] == 0) { diff++; len = min(len, second - first + 1); first++; break; } first++; } } second++; } return len; } int main() { string str; cout
@deepanshuagarwal2471
@deepanshuagarwal2471 7 ай бұрын
class Solution: def lengthOfLongestSubstring(self, s: str) -> int: count=[0]*256 first=0 second=0 len1=0 while second
@joydeep-halder
@joydeep-halder Жыл бұрын
We can optimize the solution of second problem by removing the first inner while loop 🚀🚀 while(second
@pradeepraghu1see
@pradeepraghu1see 4 ай бұрын
second-first kyu instead of second-first +1
@MohammedHasmi577
@MohammedHasmi577 19 күн бұрын
Still I don't understand why this? ​@@pradeepraghu1see
@newglobal7271
@newglobal7271 Жыл бұрын
Maja agya , chamka ❤❤❤❤🙏🙏🙏🙏🙏🙏
@DevanshGupta-io7rl
@DevanshGupta-io7rl Жыл бұрын
bahut hard challenge hai ye to maza aa raha
@saketjaiswalSJ
@saketjaiswalSJ 10 ай бұрын
Hacker or wott bhaii❤❤
@sohamjain8599
@sohamjain8599 Жыл бұрын
Bhaiya, please make a detailed video for first year students. We need a 4 year roadmap video so that an can get an idea.
@4minix643
@4minix643 3 ай бұрын
class Solution { public: int lengthOfLongestSubstring(string s) { int maxLen = 0; int n = s.size(); if(n == 0)return 0; //iterate over all possible //substrings for(int i=0; i
@ankushladani496
@ankushladani496 Жыл бұрын
Done Bhaiya... Day 57/180 ✅
@rashmimohan1863
@rashmimohan1863 11 ай бұрын
Great Explanation 😊
@Vaibhavvashishtha123
@Vaibhavvashishtha123 11 ай бұрын
Can anyone pls share the code and logic for homework question longest substring with k unique character
@Babita-y7w3o
@Babita-y7w3o 3 ай бұрын
Ques 1___ BRUTE FORCE... string s; cin>>s; int ans=INT_MIN,w=1; while(w
@Ikkhhku
@Ikkhhku Жыл бұрын
Good Morning 🌞
@shrivvlogs6045
@shrivvlogs6045 Жыл бұрын
Love u bhiya ❤️
@shubhamkumarjha9192
@shubhamkumarjha9192 Жыл бұрын
Good morning bhaiya..#day57
@joydeep-halder
@joydeep-halder Жыл бұрын
Good morning bhaiya ❤❤
@technicalraftaar1487
@technicalraftaar1487 3 ай бұрын
Love from Bihar
@AIWALABRO
@AIWALABRO Жыл бұрын
Brother I am learning Data Science, and most of the DS have the fear of DSA. i mean they don't have indept knowledge of DSA. . 1) let suppose, i have to continue from this video then can i continued or i have to follow some previous videos of yours. 2) most of the time DS code in python , so can I do DSA in python? or you suggesting some thing different. 3) if I want a code of this problem in python then where should I get. I already registered of 99 Rs in your website, so are you tech supporters provide support over there? I am waiting for your response...from last 3 days happened. if you have mail id then pls provide if any kind of queries so i can direct reach out to you!
@Pramod_saraswat001
@Pramod_saraswat001 Жыл бұрын
Good morning bhaiya
@motivationalmajakkhel
@motivationalmajakkhel 3 ай бұрын
Homework: Smallest window containing 0,1 and 2 int smallestSubstring(string s) { // Code here int length = -1, size = s.size(); vector a(3, 0); for(int i=0; i
@sanketbiradar7978
@sanketbiradar7978 9 ай бұрын
Best video
@rhitam_biswas
@rhitam_biswas 4 ай бұрын
18:03 Rohit bhaiya's "kuch bhi ho sakta hain" accent bohut zyada similer hain Bhaibav's "Kuch Bhi Ho sakta hain " ( Kota Factory) 😂
@Sharmila-j4e
@Sharmila-j4e 4 күн бұрын
guys ,the 1st question was asked in accenture interview
@ahmadhassan90590
@ahmadhassan90590 9 ай бұрын
high sir 🔥
@Aranyak.123
@Aranyak.123 5 ай бұрын
unique character ke liye set use kr skte the kya??
@Iamvijay23
@Iamvijay23 Жыл бұрын
Jab Tak todenege nahi tab tak chorenge nahi Day 57/180
@cosmickingthor6676
@cosmickingthor6676 8 ай бұрын
good content bhai....
@anuragyadav5065
@anuragyadav5065 Ай бұрын
v.clear() run karne prr saari values 0 nhi hoke 1 ho jaati hai aisa kyu?
@cybrarygamer486
@cybrarygamer486 Жыл бұрын
First comment bhaiya 🎉🎉🎉🎉 in this video
@GopalKumar-xu3iw
@GopalKumar-xu3iw Жыл бұрын
Day 57/180 done ✅✅✅✅✅✅✅✅
@allinonemoviesyt
@allinonemoviesyt Жыл бұрын
good morning sir
@firecrusher1384
@firecrusher1384 Жыл бұрын
chamak gaya bhaiya.
@Mr.FalseChecker
@Mr.FalseChecker Жыл бұрын
Thank you very much
@deepanshuagarwal2471
@deepanshuagarwal2471 7 ай бұрын
str = "aaabcccccccaaaabbbb" count = [0] * 256 first = 0 second = 0 diff = 0 let = len(str) # Count the number of unique characters while first < len(str): if count[ord(str[first])] == 0: diff += 1 count[ord(str[first])] += 1 first += 1 # Reset variables for sliding window for i in range(0, 256): count[i] = 0 first = 0 # Initialize let to store the length of the smallest substring containing all distinct characters while second < len(str): # Slide the window until all distinct characters are present while diff and second < len(str): if count[ord(str[second])] == 0: diff -= 1 count[ord(str[second])] += 1 second += 1 # Update let let = min(let, second - first) # Slide the window until there's a character repetition while diff != 1: let = min(let, second - first) count[ord(str[first])] -= 1 if count[ord(str[first])] == 0: diff += 1 first+=1 print(let)
@Pramod_saraswat001
@Pramod_saraswat001 Жыл бұрын
Bhaiya Mene DSA playlist ko last week se start Kiya h M abi 14 lecture pr hu Kya m app k saath ess ko continue kr skta hu Kya yhaa se Mere samjh m aa skta h Yaa fir m lec 14 se hee continue rakhu
@lyricalboy9281
@lyricalboy9281 Жыл бұрын
day 57 completed #180dayscodingchallenge #coderArmy
@yashdabral2773
@yashdabral2773 3 ай бұрын
Homework question - 3 int smallestSubstring(string S) { // Code here vectorcount(3,0); int first = 0; int second = 0; int length = S.size(); int diff = 0; for(int i = 0; i< S.size();i++){ if(count[S[i]-'0'] == 0){ diff++; } count[S[i]-'0']++; } first = 0; if(diff < 3){ return -1; } for(int i = 0; i
@a.gcrazy555
@a.gcrazy555 2 ай бұрын
why can't we use map instead of vector it will save memory in first question;
@heetpatel3037
@heetpatel3037 8 ай бұрын
Chamka par Aaj thoda hard Laga😊
@drlovephukn
@drlovephukn Жыл бұрын
Day 57/180 , full power full power
@asad_iliyas
@asad_iliyas 11 ай бұрын
Homework question 4: int longestKSubstr(string s, int k) { // your code here int n=s.size(); vectorcount(26,0); int first=0,second=0; int uniquechar=0; int length=0; //check if answer possible or not for(int i=0;i
@yashubisen7131
@yashubisen7131 Жыл бұрын
Gm bhaiya ❤
@ayeshasolanki5386
@ayeshasolanki5386 Жыл бұрын
Are you not going to upload homesheet on strings?
@AakashParvani
@AakashParvani Жыл бұрын
Day 57 👍✅
@air1topped738
@air1topped738 Жыл бұрын
Bhaiya kai recession hoga if yes than when it will end
@dipakmali9817
@dipakmali9817 Жыл бұрын
Day 57/180 Done ✅
@farhansadik7236
@farhansadik7236 Ай бұрын
why not second-first+1? can anyone explain this
@ankushladani496
@ankushladani496 Жыл бұрын
Thanks Bhaiya...❤🎉
@motivationalmajakkhel
@motivationalmajakkhel 3 ай бұрын
Homework 2: Longest K sub string int longestKSubstr(string s, int k) { int length = 0; int diff = 0; vector count(256, 0); for(int i=0; i
@vasupratapsingh3652
@vasupratapsingh3652 9 ай бұрын
👌🏻👌🏻
@akashkewat1219
@akashkewat1219 Жыл бұрын
🎉thank bhaiya😊.
@lyricalboy9281
@lyricalboy9281 Жыл бұрын
Bhaiya homework questions nhi hote aur leetcode pr jao toh naye questions bante hi nhi consistent bhi hai code ko dry run bhi karte hai aur homework solve karne ki bhi koshish karte hai uske baad bhi😢😢
@GopalKumar-xu3iw
@GopalKumar-xu3iw Жыл бұрын
Same bhai wahi problem h
@kartik5134
@kartik5134 Жыл бұрын
34:44 chamak gya bhiaya
@Aniruddha_Mukherjee
@Aniruddha_Mukherjee Жыл бұрын
Josh is always high Bhaiya.
@HARSHRAJ-gp6ve
@HARSHRAJ-gp6ve 4 ай бұрын
Bhaiya smallest distinct widow ke ques ka solution de do plese c++ ka 0(n^2) wala
@shrivvlogs6045
@shrivvlogs6045 Жыл бұрын
Chamka++
@omsingh00017
@omsingh00017 2 ай бұрын
2nd problem to bilkul samjh nahi aayi...aaj laga recorded or live me difference...jitne baar bahiya kah rahe ..samjh a gaya hoga utni baar gussa lag rahi...
@carcompares9022
@carcompares9022 3 ай бұрын
har har mahadev
@indian_gaurav_8648
@indian_gaurav_8648 Жыл бұрын
33:11 bhiya ise hum while loop se pehle likhna chahiye na or while loop ke andr hum first ko 0 kar rhe h wo to pehle se hi zero h
@divyanshsharma673
@divyanshsharma673 11 ай бұрын
But also count[S[second]] is zero so that loop to make first 0, wouldn't execute.
@Billy-gd1rm
@Billy-gd1rm Ай бұрын
❤❤
@adityapawar6174
@adityapawar6174 4 ай бұрын
Lecture 41 check ✅
@procrastinator0811
@procrastinator0811 11 ай бұрын
2. PYTHON Solution (Smallest Distinct Window) #User function Template for python3 class Solution: def findSubString(self, s): # Your code goes here #find num of distinct char in the string unique_char = len(set(s)) if unique_char == 1: return 1 min_len = len(s) # print(unique_char) freq = {} first = 0 second = 0 while second < len(s): if s[second] not in freq: freq[s[second]] = 1 unique_char -= 1 if unique_char == 0: #we got one probable ans min_len = min(min_len,second - first + 1) #let's try to reduce the min length further while True: freq[s[first]] -= 1 if freq[s[first]] == 0: unique_char += 1 freq.pop(s[first]) first += 1 break else: first += 1 min_len = min(min_len,second - first + 1) else: freq[s[second]] += 1 second += 1 return min_len
@deep_singh01
@deep_singh01 Жыл бұрын
Day 57/180 👍👍
@nitinduke
@nitinduke Жыл бұрын
01:14:24 in java class Solution { public int findSubString( String str) { // Your code goes here int[] count = new int[256]; int first=0,second=0,len=str.length(),diff=0; //Calculate all the unique char while(first
@ShaikSharma
@ShaikSharma 12 күн бұрын
chamak gaya bayya
@AbhishekKumar-lu3lp
@AbhishekKumar-lu3lp Жыл бұрын
Bhai india har gyi
@colabbro7789
@colabbro7789 10 ай бұрын
Bhaiya first problem ka brutforce approach hi nahi bani . Nahi o(n^3) time aur na hi o(n^2).
@awadhigeet9692
@awadhigeet9692 Ай бұрын
Bhai longest sub string ka to O(n^2) hoga n kaise aya samaj nahi a eha
@joydeep-halder
@joydeep-halder Жыл бұрын
✅✅ HW Solution for problem 3: int smallestSubstring(string s) { // Code here if (s.size() < 3) return -1; vector count(3, 0); int first = 0, second = 0, len = INT_MAX, diff = 3; while (second < s.size()) { if (count[s[second] - '0'] == 0) diff--; count[s[second] - '0']++; second++; while (diff == 0) { len = min(len, second - first); count[s[first] - '0']--; if (count[s[first] - '0'] == 0) diff++; first++; } } return (len == INT_MAX) ? -1 : len; }
@dayashankarlakhotia4943
@dayashankarlakhotia4943 Жыл бұрын
public int findSubstring (String str){ int n=str.length (); Setset=new HashSet (); for(int i=0;i
@procrastinator0811
@procrastinator0811 11 ай бұрын
1. PYTHON CODE def lengthOfLongestSubstring(self, s: str) -> int: l = len(s) if l == 0 or l == 1: return l first = 0 second = 0 char_freq = {} max_len = 0 while second < l: if s[second] in char_freq: while True: if s[first] == s[second]: char_freq[s[first]] = second first += 1 second += 1 break else: char_freq.pop(s[first]) first += 1 else: max_len = max(max_len,second-first+1) char_freq[s[second]] = second second += 1 return max_len
@nownow1025
@nownow1025 9 ай бұрын
//smallest distinct window logic same just code part different #include #include using namespace std; int findSubString(string str) { vectorcount(256,0); int diff=0; for (int i = 0; i < str.size(); i++) { // string str="AABBBCBBAC"; found distinct characters. if (count[str[i]]==0) { diff++; count[str[i]]++; cout
@Rishi_s.corner
@Rishi_s.corner 8 ай бұрын
#revision done of string lect 41 on date 3/3/2024
@averagecoder7
@averagecoder7 Жыл бұрын
Day 57/180 ✅
Sliding Window: Zero Sum Subarrays | Subarray Sum Equals K
1:00:55
БУ, ИСПУГАЛСЯ?? #shorts
00:22
Паша Осадчий
Рет қаралды 2,9 МЛН
快乐总是短暂的!😂 #搞笑夫妻 #爱美食爱生活 #搞笑达人
00:14
朱大帅and依美姐
Рет қаралды 12 МЛН
14.Prototype Design Pattern + Example
12:05
Lập trình web full-stack-Java
Рет қаралды 12
Sliding Window Technique - Algorithmic Mental Models
36:45
Ryan Schachte
Рет қаралды 362 М.
Coding Unbreakable Encryption in C | One-Time Pad
17:42
HirschDaniel
Рет қаралды 4,6 М.
Lecture 44: Strings HARD Problems For Coding Round
1:00:50
Coder Army
Рет қаралды 20 М.
L12. Minimum Window Substring | 2 Pointers and Sliding Window Playlist
27:06
Resources I Followed to Crack Placement in 3 month's 💯
10:44
Ajay Raj
Рет қаралды 1,1 МЛН
Lecture 56: Recursion in Strings
43:45
Coder Army
Рет қаралды 15 М.