Lecture22: All about Char Arrays, Strings & solving LeetCode Questions

  Рет қаралды 1,148,929

CodeHelp - by Babbar

CodeHelp - by Babbar

Күн бұрын

Пікірлер: 1 300
@sahilanand30
@sahilanand30 3 жыл бұрын
Very few KZbinrs can maintain such consistency with such quality content 🔥
@inter3988
@inter3988 10 ай бұрын
great video whenever you show a new problem, I spend at least 30 min or more trying to solve it. Then if I can't or after solving, I see the solution you provide. Never thought problem solving would be this addictive
@incnomercy6573
@incnomercy6573 10 ай бұрын
did you solve this problem 57:15 if yes please share the code
@sahilanand30
@sahilanand30 3 жыл бұрын
The best thing about this course is, it covers wide range of topics which is helpful for beginners as well as advance programmers!
@mdwaqar7401
@mdwaqar7401 Жыл бұрын
Finally Completed this Video after 5 days. Have to say this was the Toughest to Digest and Code and Understand so far in the journey But Worth every Second. Now I am much confident with String. Thanks Bhaiyya !! Onto the next video.
@dEviL_bIsWaJiT
@dEviL_bIsWaJiT 2 жыл бұрын
*Key Differences Between Character Array and String* A character array is a collection of variables which are of character datatype. String is a class that is instantiated to declare strings. Using index value you can access a character from a character array. On the other hand, if you want to access a particular character in a string, you can access it by function string’s_name.charAt(index). As an array is not a datatype similarly a character also is not a datatype. On the other hand, String being a class act as a reference type hence, it can be said String is a data type. You can not apply any operator on a character array whereas, you can apply operators on String. Being an array character array has a fixed length and its boundaries can be easily overrun. Where String does not have any boundaries. Array elements are stored in a contiguous memory location hence that can be accessed faster than string variable.
@AbhishekKumar-nz9dn
@AbhishekKumar-nz9dn 2 жыл бұрын
thanks for this bro🙏👍
@prathamsharma5016
@prathamsharma5016 2 жыл бұрын
Very informative thank you
@sagarbiradar1104
@sagarbiradar1104 2 жыл бұрын
Mast kam karta hai tu
@shivashiskar8421
@shivashiskar8421 2 жыл бұрын
ok rana bhaiii
@dEviL_bIsWaJiT
@dEviL_bIsWaJiT 2 жыл бұрын
@@shivashiskar8421 😅
@SandipDas-bd2pt
@SandipDas-bd2pt 3 жыл бұрын
This is my favourite channel. I especially like it when you explain everything so nicely. I wish you a lot of success with the channel and happy life.
@shubhamaths
@shubhamaths 2 жыл бұрын
4 din lag geya 🥲🥲 Complete karne me.
@harshitverma2707
@harshitverma2707 2 жыл бұрын
Ek din ka kaam hai bhai ye to
@rishabh_pant
@rishabh_pant Жыл бұрын
We keep trying :) 💪
@suxsfulrecovery7161
@suxsfulrecovery7161 Жыл бұрын
​@@harshitverma2707 nah bhai humse ek din mai na hu paiga
@gauravbisht504
@gauravbisht504 Жыл бұрын
Chota bachcha h kya😂
@shivakashyap5017
@shivakashyap5017 Жыл бұрын
Bhai mujhe 5 din lag gaye complete karne me , kyu bhai jab problem khud se apna 100% dekar solve karne than lete h to time lagta h , 5 minute dekar hamse na ho payega ye soch kar solution dekh lene se kiya phayada phle 2 se 3 ghante do problem ko nahi hua to phir solution dekho or uske bad bhi khud se karo
@mlkgpta2869
@mlkgpta2869 Жыл бұрын
In this 2 hours of lecture i learnt about 10 hours of content by going through other optimized solution in discussion section, refering different stl libraries for new function, learning from errors...
@ayushkushwaha171
@ayushkushwaha171 3 жыл бұрын
took me like 2 days to complete this video. really enjoyed it. thanks bro
@anishtripathi3800
@anishtripathi3800 6 ай бұрын
Bhaiya ye video maine 3 din me complete ki hai... Lekin ek ek explaination ko 2- 3 baar dekha, implement kiya.. aur cheezein samajh aane lagi. Thank you bhaiya.
@Gungun-ce4ox
@Gungun-ce4ox 6 ай бұрын
are you also learn string 1st time?? i am following this playlist and all videos i understand easily but that particular video i didn't understand
@subrinasirajee2109
@subrinasirajee2109 3 жыл бұрын
Hi Mr. Love Babbar. Your content is just amazing. Thank you so much from Bangladesh.
@sambhavsharma2780
@sambhavsharma2780 2 жыл бұрын
for converting upper case to lower case simply add ( ch+32 ) and for converting lower case to upper case simply subtract ( ch-32 ).
@pranshul40
@pranshul40 2 жыл бұрын
Please explain me the code when the string is 'aabbBcD' , then output is 'b' because maximum occurrence in string is b
@scoc55vora15
@scoc55vora15 2 жыл бұрын
Amazing
@gurtegsinghsohi411
@gurtegsinghsohi411 Жыл бұрын
​@@scoc55vora15 can you provide answer of 57:15
@adityakant9736
@adityakant9736 Жыл бұрын
Because 'a' - 'A' is 32🐘
@deepanshusingh3623
@deepanshusingh3623 Жыл бұрын
mere code me error de rha tha esa krne pe ....
@sayanmukherjee1445
@sayanmukherjee1445 Жыл бұрын
This is a really good course and more better than many premium courses of DS & Algo. Thank you is not enough for this course.
@codewithmames
@codewithmames Жыл бұрын
hello bro
@Aatifkhan-pq6kv
@Aatifkhan-pq6kv 3 жыл бұрын
Present bhaiyya, I am on 1:00:45 timestamp........ To be honest, by far the best video ever watched on these topics❤️❤️ absolutely loving the way u mould us to solve any problem. You are a gem 💎
@arnobbaiga309
@arnobbaiga309 2 жыл бұрын
bro 1:47:28 why he did char[ansindex++]?
@ravishekhawat5958
@ravishekhawat5958 Жыл бұрын
@@arnobbaiga309 quki char ko store krne k baad ans vector ka index bgi increment krna pdega ... Tbhi to uske next index pr ya to char ya bhi uski occurrence daal payenge
@Raj_Tanvar
@Raj_Tanvar 3 жыл бұрын
I don't care about length I care only about content which is fantastic 👌
@apurbakumarmajumder9478
@apurbakumarmajumder9478 3 жыл бұрын
Me too bro Length doesn't matter, Quality is all that matters. And more over we have to learn this topics may not today then tomorrow but we all have to understand this topics so why not today.
@arnobbaiga309
@arnobbaiga309 2 жыл бұрын
bro 1:47:28 why he did char[ansindex++]?
@darshanbhaiya8711
@darshanbhaiya8711 11 ай бұрын
after comparing it will atomatically increase the pointer @@arnobbaiga309
@saurabhvishwakarma9616
@saurabhvishwakarma9616 2 жыл бұрын
Best solution for Remove all Adjacent Duplicates 1:39:00 string removeDuplicates(string s) { string res; for(char ch : s){ if(!res.empty() && res[res.size() - 1] == ch) res.pop_back(); else res+=ch; } return res; }
@Anonymous-ng5dw
@Anonymous-ng5dw Жыл бұрын
FOR MY REFERENCE:- A character array is a collection of variables which are of character datatype. String is a class that is instantiated to declare strings. Using index value you can access a character from a character array. On the other hand, if you want to access a particular character in a string, you can access it by function string’s_name.charAt(index). As an array is not a datatype similarly a character also is not a datatype. On the other hand, String being a class act as a reference type hence, it can be said String is a data type. You can not apply any operator on a character array whereas, you can apply operators on String. Being an array character array has a fixed length and its boundaries can be easily overrun. Where String does not have any boundaries. Array elements are stored in a contiguous memory location hence that can be accessed faster than string variable.
@yashkum095
@yashkum095 Жыл бұрын
A character array is actually different from cstring, the thing he was using here was a cstring and not character array, try declaring a character array explicity by yourself as if it was an integer array, you'll see
@Vikram-Sharma-
@Vikram-Sharma- 3 жыл бұрын
HW - 3 Auxilary space O(0) for space replacement with @40 problem string replaceSpaces(string &str){ // Write your code here. int l = str.length(); string rep = "@40"; for(int i = 0; i
@mohitbansal222
@mohitbansal222 2 жыл бұрын
str.replace(i,1,rep); esme 1 kis kiya likha ha
@ishratkaur1605
@ishratkaur1605 2 жыл бұрын
@@mohitbansal222 Probably because we have to replace a space of size 1 with the string rep.
@mohitbansal321
@mohitbansal321 2 жыл бұрын
@@ishratkaur1605 thanks
@avibirla9863
@avibirla9863 2 жыл бұрын
@@mohitbansal222 i,1 ..specifies range of indexes i.e till which range you have to replace
@rameshmalhotra9525
@rameshmalhotra9525 2 жыл бұрын
kzbin.info/www/bejne/qnK0en6bZbp6fpY
@muatasimahmed2343
@muatasimahmed2343 3 жыл бұрын
Seeing you consistent My brains demands consistent from ...Ajj ka attendance laag gya😃 Thanks Bhaiyaa ☺️
@arnobbaiga309
@arnobbaiga309 2 жыл бұрын
bro 1:47:28 why he did char[ansindex++]?
@aadityakumar8604
@aadityakumar8604 4 ай бұрын
ch-'A'+'a' ------> ch+32 likh sakte hai ( to convert capital to smallest) Or ch-32 for vice versa
@themindtreatment
@themindtreatment Жыл бұрын
very few youtubers can maintain such consistency with such quality content good job brother
@gurtegsinghsohi411
@gurtegsinghsohi411 Жыл бұрын
Can you provide answer of 57:15
@md.ualiurrahmanrahat2400
@md.ualiurrahmanrahat2400 3 жыл бұрын
You are like a superhero to us. Consistency is unbelievable!! You are a man of words Vaiya. You're keeping your promises. Salute.
@arnobbaiga309
@arnobbaiga309 2 жыл бұрын
bro 1:47:28 why he did char[ansindex++]?
@abhishekmaurya6594
@abhishekmaurya6594 Жыл бұрын
@@arnobbaiga309 actually he is storing the old character in ansIndex and than post incremented
@artifice_abhi
@artifice_abhi 2 жыл бұрын
42:46 Valid Palindrome Apne jo approach check palindrome m btai usse kaafi asan hogya ... mne kaafi complex kardi thi approach class Solution { public: string toLowercase(string s){ string ans; for(int i = 0; i= 'A' && s[i] = 'a' && s[i] = '0' && s[i]
@imPriyansh77
@imPriyansh77 Жыл бұрын
The way you broke down the problem in 3 steps at 54:58 is just awesome ! Thanks Bhaiya :)
@CentristPerspective
@CentristPerspective Жыл бұрын
He misunderstood the question, the question doesn't states that
@shadprakash
@shadprakash 2 ай бұрын
@@CentristPerspective true, i also read the question, and it says to reverse the words, not the letters. eg :- input --> the sky is blue output --> blue is sky the He didn't pay it much attention and just read the title that's why he might've misunderstood ig, that's why there were no submissions as well lol, cuz he mistook that question for some other question.
@ravishsingla4454
@ravishsingla4454 Жыл бұрын
what a dedication this man has recorded the video from about 3:00 am to morning 6:40 am, Hats off to you. 🔥🔥
@satyamgoenka6287
@satyamgoenka6287 Жыл бұрын
mai bhi itti hi dedication ke saath pubg khelta tha bro..kabhi🥲
@BOSS55
@BOSS55 Жыл бұрын
ha yyar @@satyamgoenka6287
@043-h-subhashreebastia7
@043-h-subhashreebastia7 Жыл бұрын
thoda tough tha questions par bhaiya do baar dikhne se samajh aa rhi h thank you bhaiya☺
@newhope5729
@newhope5729 Жыл бұрын
Didi please reply I request pleeees
@akashverma5880
@akashverma5880 2 жыл бұрын
#include #include using namespace std; int main() { string s = "my name is akash"; int start = 0; int p = 0; for (int i = 0; i
@MyAnish22
@MyAnish22 2 жыл бұрын
Akash, my code looks similar but it isnt working, can you review? #include #include using namespace std; void reversewordsinaString(string str){ int len = str.length()-1; int i = 0; int j = 0; int s = i; while (i
@ananyapandey8162
@ananyapandey8162 2 жыл бұрын
@@MyAnish22 bhai tune getline to declare Kiya Hua hai but utne koyi function ESA initialize hi nahi kiya jisme getline ho
@Mohddanish-ly4yx
@Mohddanish-ly4yx Жыл бұрын
Thank you
@aashutoshsathe8078
@aashutoshsathe8078 Жыл бұрын
thank you bro this was very helpful
@8BitGamerYT1
@8BitGamerYT1 10 ай бұрын
can we do without losing the O(N) time complexity?
@ABHISHEKRAI-n9k
@ABHISHEKRAI-n9k 5 ай бұрын
sir maja hi aa gaya question ban ja raha h jab aap acha sa samjha da raha h and kabhi kabhi 50 to 60% ma khud hi soch pa raha hoon jabki sirf 5 days hi hua h apki video dekha hua
@kailashdaata8610
@kailashdaata8610 3 жыл бұрын
I love this series, Thanks for providing this content. One feedback, plz explain the code by more dry run(specially permutation question), also 30-40 min video length will be good.
@sagarbiradar1104
@sagarbiradar1104 2 жыл бұрын
I thought you put photo babbar than i realized on closer look that its not babbars photo but maybe your photo😁
@RAHUL-pe7jv
@RAHUL-pe7jv 2 жыл бұрын
@@sagarbiradar1104 😀
@AnujTiwari-g8o
@AnujTiwari-g8o 9 ай бұрын
bhaiya aapki 2 ghante ki video mere liyea poora din hota .... code samajhne me bhi time lagta hai..... apne end se errors aajae to unhe bhi solve karna hota hai ..... but i will never stop learning ....
@anuragpandey8165
@anuragpandey8165 3 жыл бұрын
Completed - 1:53:19 Great explanation.
@technologytrends645
@technologytrends645 9 ай бұрын
//Happy that I am able to solve it //Homework - Remove All Adjacent Duplicates In String string removeDuplicates(string s) { int i=0; while( i < s.length() ){ if(s[i] == s[i+1]){ s.erase(i,2); if(i > 0){ i--; } } else{ i++; } } return s; }
@only_for_fun1234r
@only_for_fun1234r 3 жыл бұрын
Difficult for me, me studying string for 1st time but maja boht aya 🔥🔥
@tanishgupta7505
@tanishgupta7505 2 жыл бұрын
reverse of a string using stl is way simple : string babbar = "babbar"; reverse(babbar.begin() , babbar.end() ); cout
@sharedme4471
@sharedme4471 2 жыл бұрын
💡 HomeWork 1:17:12 - replace space [O(1) space solution] : for(int i=0;i
@cuteanime2
@cuteanime2 2 жыл бұрын
well done bro 👌
@kms8320
@kms8320 2 жыл бұрын
What is the time complexity of this? Is it O(N^2) ?
@sharedme4471
@sharedme4471 2 жыл бұрын
@@kms8320 O(N), bcs here is only one loop
@lateshbansal7801
@lateshbansal7801 2 жыл бұрын
iska output sai nhi aara
@devangsingh2950
@devangsingh2950 2 жыл бұрын
actually this will become O(N2) in complexity because making substring in c++ will take linear time not constant time, also using insert will cause also O(N2), as it was given in cpp site that these operations are linear in T.C.
@Listenup831
@Listenup831 Жыл бұрын
sir, aapke charno me mera shat shat naman, bahut lecture dekhne ke baad, aaj aapse string clear hua
@sherebanoburhani8939
@sherebanoburhani8939 3 жыл бұрын
Present bhaiya. I am still on lecture 8 (just busy with all my assignnents and internals of college😩😩😩) It's going to be an amazing video I am sure of that.
@RahulKumar-wt9qc
@RahulKumar-wt9qc 2 жыл бұрын
Don't worry , try to manage time and never give up, best of luck 👍👍👍👍
@rameshmalhotra9525
@rameshmalhotra9525 2 жыл бұрын
kzbin.info/www/bejne/qnK0en6bZbp6fpY
@sourabhsingh5941
@sourabhsingh5941 2 жыл бұрын
1:23:00 why are we checking this condition -> s.find(part) < s.length() what is the reason plz help
@rahulrastogi5312
@rahulrastogi5312 3 жыл бұрын
Just finished the video...Haven't seen better way of teaching than this..#TheProblemSolvingWay... really grateful bhaiya ..one of the best videos of this course till date ❤️🙏🏻...1hr+ content really helps in many ways specially understanding
@shreyansh_yadav
@shreyansh_yadav 3 жыл бұрын
Just abhi poori vid complete hui, Mza aaya bhaiya
@anjanimittal9313
@anjanimittal9313 Жыл бұрын
Reverse Words: Code: #include using namespace std; void reverse(string &s, int x, int y) { while(x
@ankitsahu1575
@ankitsahu1575 Жыл бұрын
Thank you for your answer Anjali, it helped me a lot.
@ayushmanagarwal4323
@ayushmanagarwal4323 Жыл бұрын
nice work
@Arcgamerz27
@Arcgamerz27 11 ай бұрын
could you explain how: y=i-1 and x=y+2 came.
@ultrondanger1208
@ultrondanger1208 11 ай бұрын
nice
@champ-kx9lb
@champ-kx9lb 9 ай бұрын
Thank you @anjanimittal9313 for your answer as this q was lock for non premium members!! can you explain me pls how first word is reversed? it will help me alot
@RohitKannaujiya-i1r
@RohitKannaujiya-i1r 3 ай бұрын
Aaj mja aa gya padhne me bas ab hamaari baari khud se solve karne ki inn sab question ko ❤ Ab aur mja aayega bhaiya❤❤❤🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉
@priyapandey8951
@priyapandey8951 2 жыл бұрын
@Babbar Bhaiya, Homework at 1:17:12 it can be done in-place using replace method also:- string replaceSpaces(string &str){ // Write your code here. for(int i=0;str[i]!='\0';i++){ if(str[i]==32){ str.replace (i,1,"@40",0,3); } } return str; }
@anmol3
@anmol3 Жыл бұрын
@Hiranmay Formal can you provide me with the link to real solution, without using inbuilt functions. Thanks.
@anmol3
@anmol3 Жыл бұрын
@Seekersbay thanks a lot brother
@nityamtiwari8502
@nityamtiwari8502 2 жыл бұрын
bhaiya yaar "Remove all occurrences of substring" mei jo approach lagai aapne , wo tagda tha , maja hi aa gaya sahi mein.
@awais_ansarii
@awais_ansarii 2 жыл бұрын
Present bhaiyya, TBH, by far the best video ever watched on these topics❤❤ absolutely loving the way u mould us to solve any problem. You are a gem 💎
@GAURAVKUMAR-rt4gd
@GAURAVKUMAR-rt4gd 7 ай бұрын
most occurrence char wala question me sbse phle string sort krke fir while loop lagake conditional statement use krke ho jayega....... NEW APPROACH
@017_indrasen9
@017_indrasen9 Жыл бұрын
At 1:18:00 we can use "str.replace(i, 1, "@40");" for any space occurence
@vishalrajiwade6964
@vishalrajiwade6964 10 ай бұрын
03:22 Understanding and using character arrays and strings 13:35 Understanding character arrays and string manipulation 17:32 Understanding char arrays, strings, and solving LeetCode questions. 23:56 Understanding different types of character arrays and their applications 26:49 Understanding the process of subscribing and subscribing to a channel. 36:03 Understanding character arrays and string manipulation 40:24 Understanding char arrays, strings and solving LeetCode questions 46:58 Discussion on subscriptions and useful content 51:29 Understanding char arrays, strings, and LeetCode problem-solving. 58:25 Usage of char arrays and strings in coding. 1:01:17 Understanding char arrays, strings, and solving LeetCode questions 1:07:21 Understanding char arrays and strings in C++ 1:11:00 Understanding char arrays and strings 1:16:46 Understanding the solution for specific lengths and balancing 1:20:34 Understanding char arrays, strings, and LeetCode questions. 1:27:01 Understanding char arrays and strings in C++ 1:30:15 Understanding array operations and processing strings 1:35:53 Understanding and solving char arrays and strings 1:38:25 Understanding Char Arrays and Strings 1:44:05 Cleaning and maintenance of char arrays and strings 1:47:43 Understanding account management and settings 1:52:40 Understanding the size of a tractor
@siddhishitole3986
@siddhishitole3986 3 жыл бұрын
Thank you sir for effort and time ur taking out for us.. Motivating us to do more ✨🙂
@abdxlive
@abdxlive 5 ай бұрын
52:00 TBC Insha-Allah | Thanks Bhaiya Ji ❤️
@Name-f9v1n
@Name-f9v1n 2 ай бұрын
It's 1:40 Am 6/10/24 , Alhamdulillah ❤ i completed this long and tough lecture.
@AjaySharma-gg8dv
@AjaySharma-gg8dv 2 ай бұрын
bhai mera aaj hua , ek saval tha bhai ki apna college walo ka bhi dsa aa gaya hai u tube per , vo follow karu ya yahi
@52hsrah
@52hsrah 3 ай бұрын
String Handling Input: std::string s = "ab\0cd\0"; Behavior: The string will contain all characters, including the null terminators. The length of the string will be 5 (including the null characters). Printing the entire string will show all characters. Size and Length: s.size() will return 5 s.length() will also return 5 Iteration: Iterating through the string will include all characters, including nulls. Substring Extraction: Extracting substrings will preserve null characters. Char Array Handling Input: char ca[] = "ab\0cd\0"; Behavior: The char array will be terminated at the first null character. Only "ab" will be considered part of the string. The second "\0" and "cd" will be ignored. Size and Length: strlen(ca) will return 2 sizeof(ca) will return the total size of the array (likely 6) Iteration: Standard string functions like printf("%s", ca) will stop at the first null character. Substring Extraction: Attempting to extract substrings beyond the first null will result in undefined behavior. Key Differences Null Terminator Handling: Strings can contain null characters; char arrays treat them as terminators. Length Calculation: Strings calculate length including nulls; char arrays stop at the first null. Memory Usage: Strings allocate memory dynamically; char arrays have fixed size. Flexibility: Strings offer more flexibility in handling special characters. Compatibility: Char arrays are compatible with C-style string functions; strings require C++ methods.
@chandrabhanthakkangar8380
@chandrabhanthakkangar8380 Жыл бұрын
Maine puri video dekhi hai bhaiya.. Sachme bhaiya dilse kaha raha hu pahle muze dsa problems ko tackle karna bahot hard lagta tha jabse aapka KZbin channel dsa ka series follow kiya na bhaiya sachme ekdam tagda aatama-vishvas bahot jyada high ho raha hai.. Thank for such awesome series bhaiya ❤.. Mai abtak 22 lecture dekh liye hai bhaiya...
@vanshmehan8634
@vanshmehan8634 2 жыл бұрын
❤‍🔥Easy Code for 01:23:30 - Permutation in String ❤‍🔥 #include using namespace std; #include #include bool checkPer(string s1, string s2){ while(s1.length()!=0 && s1.find(s2)
@ankushraj9583
@ankushraj9583 2 жыл бұрын
does it work? where is it calculating for all permutations. from what I am understanding it's just checking from original order and a reverse.
@vanshmehan8634
@vanshmehan8634 2 жыл бұрын
@Ankush Raj yess you r right!! I understood the question wrong!! Thanks buddy👍🏻
@smarthgarg6305
@smarthgarg6305 2 жыл бұрын
very well explained ,Ik I'm bit late but loving the videos till now. Each concept is cyrstal clear till now.
@Abhinav_2060
@Abhinav_2060 Жыл бұрын
In last question of the video dont forget to add chars.erase(chars.begin()+ansIndex,chars.end()); return chars.size(); at the end or the existing elements of the chars array will also be there ,leading to incorrect ans.
@umangpatel4202
@umangpatel4202 Ай бұрын
1:10:29 bhaiya agar is code mein jo ki maximum occuring character ka hai. agar ismein input string "zac" ya esi ho jis mein koi character repeat nahi ho raha tab bhi is code mein jo character alphabetically pehle aa raha ho vo print hoga jab ki sabki occurence 1 hai to ese case mein kuch bhi print nahi hona chahiye. to iss ke liye return 'a' +ans; ke pehle aap ye if statement le sakte hai if(ans
@tanmayghosh8311
@tanmayghosh8311 2 жыл бұрын
1:17:39 str.replace(index, 1, "@40 "); this will help
@shubhamlingwal5054
@shubhamlingwal5054 2 жыл бұрын
it willl not work we need still extra space in string .Can you please share soln if it worked .
@devanshusahoo
@devanshusahoo 2 жыл бұрын
Dil se accha laga yeh video. thank you very much.
@sudhanshuprasad8508
@sudhanshuprasad8508 2 жыл бұрын
homework code given at 42:39 #include using namespace std; string reverse(string x){ int i = 0; int j = x.length() - 1; while(i
@garvmit
@garvmit 2 жыл бұрын
thnx
@kathanadalaja4990
@kathanadalaja4990 Жыл бұрын
V.push_back(reverse(x)) durai baar kyu likha bhai
@1hokage8
@1hokage8 Жыл бұрын
in the question it was mentioned without allocating extra space we need to do.
@RohitRana-tz2lr
@RohitRana-tz2lr 3 жыл бұрын
Bhut mja aara h bhaiya aapse different different question ko solve krne ki approach ko samjne m... puri video dekhi bhaiya.. keep doing it bhaiya... Thanks for everything
@muneebjaved3940
@muneebjaved3940 2 жыл бұрын
1:17:34 string replaceSpaces(string &str){ for(int i = 0; i < str.length();i++){ if(str[i]== ' '){ str.replace(i,1,"@40"); } } return str; }
@snehagupta3479
@snehagupta3479 10 ай бұрын
saw the full video in 2 days bhaiya and reffered this link to all my friends !! best video i have seen!!
@kirtigupta9983
@kirtigupta9983 3 жыл бұрын
01:17:12 QUES: Replace space in the original string.... SOL: string replaceSpaces(string &str){ // Write your code here. string s="@40"; for(int i=0;i
@DominiK037
@DominiK037 Жыл бұрын
sir told us not to use second string and you created this xd | string s= "@40" | Instead it's just | str.replace(i, 1, "@40"); | inside if loop :)
@8BitGamerYT1
@8BitGamerYT1 10 ай бұрын
@@DominiK037Not just that, s[i] is supposed to be a character right? We can't place a string in that position. Canw e?
@rishikumar-uf7tu
@rishikumar-uf7tu 5 ай бұрын
47:32 GOOD PALINDROME QUESTION REFER FOR FUTURE ALSO TIMESTAMP IN PERSONAL PPT 1:24:00 permutation in string also included in personal ppt
@KR1SH05
@KR1SH05 5 ай бұрын
send that ppt :D
@adityasinghrawat6664
@adityasinghrawat6664 2 ай бұрын
me too please
@seemantkamlapuri36
@seemantkamlapuri36 2 жыл бұрын
Salute your hard work sir 👍... & Thanks for the easiest explanation 🙏
@aryanmahendru772
@aryanmahendru772 8 ай бұрын
literally cried at 1:20:23 it took .5hr to me to get the approach and bhaiya,you did with these, in build functions in just 3-4 lines!😫😩
@vanshtyagii3498
@vanshtyagii3498 Ай бұрын
string replaceSpaces(string &str) { int spaceCount = 0; // Count Number of Spaces for(int i = 0; i < str.size(); i++){ if(str[i] == ' '){ spaceCount = spaceCount + 1; } } // Store thr current length of the string in a variable. int len = str.size(); // Find the new length. int newLength; newLength = len + (spaceCount * 2); // Resize the current string. str.resize(newLength); // Index to end of string. int index = newLength - 1; // Fill string from end. for(int k = len - 1 ; k >= 0; k--){ if(str[k] == ' '){ str[index] = '0'; str[index - 1] = '4'; str[index - 2] = '@'; index = index - 3; } else{ str[index] = str[k]; index = index - 1; } } // Return string. return str;
@abhiinavv.pullss
@abhiinavv.pullss 27 күн бұрын
good approach
@swatisinha5037
@swatisinha5037 3 жыл бұрын
this man is a gem, your explanations are soo good!
@vijaysaharan3382
@vijaysaharan3382 2 жыл бұрын
1:17:53 string rep = "@40"; for(int i=0 ; i
@bhawargujral3574
@bhawargujral3574 2 жыл бұрын
Always providing quality content 👌
@infernogamer52
@infernogamer52 2 жыл бұрын
Key Differences Between Character Array and String ------------------------------------------------------------------------------------ 1. A character array is a collection of variables which are of character datatype. String is a class that is instantiated to declare strings. 2. Using index value you can access a character from a character array. On the other hand, if you want to access a particular character in a string, you can access it by function string’s_name.charAt(index). 3. As an array is not a datatype similarly a character also is not a datatype. On the other hand, String being a class act as a reference type hence, it can be said String is a data type. 4. You can not apply any operator on a character array whereas, you can apply operators on String. 5. Being an array character array has a fixed length and its boundaries can be easily overrun. Where String does not have any boundaries. 6. Array elements are stored in a contiguous memory location hence that can be accessed faster than string variable.
@ayushsoni7823
@ayushsoni7823 2 жыл бұрын
18:24 Length of string We can directly print 'i' instead of creating count variable
@741ibrahim2
@741ibrahim2 2 жыл бұрын
i+1
@themindtreatment
@themindtreatment Жыл бұрын
the best thing about this course is it covers wide range of topics which is helpfull for beginners as well as advance programe
@kishanprajapati3327
@kishanprajapati3327 2 жыл бұрын
57:42 question 6 #include #include using namespace std; int main(){ //string s ="s","k","y"," ","t","h","e"; // char s[8] = {'s','k','y','\0','t','h','e','\0'}; string st = " sky the is blue "; int s = 0; int e = st.length()-1; while(s
@sureshmakwana8709
@sureshmakwana8709 2 жыл бұрын
But this leetcode question got locked for Premium users now 🥲
@im_sks
@im_sks 2 жыл бұрын
wrong in o/p->we want "yks eht si eulb"
@kishanprajapati3327
@kishanprajapati3327 2 жыл бұрын
@@im_sks yes but if you don't take space at the beginning and the ending it will give the wrong answer.
@aizajsamani8894
@aizajsamani8894 3 жыл бұрын
Kamaal karte hain bhaiya ji, itna bada video😰...Khair dekhna toh padega hi😁 Thank You bhaiya ji🙂
@GauravSharma-ze4cu
@GauravSharma-ze4cu Жыл бұрын
55:27 question 5 is little different btw great video
@rohanmahajan6129
@rohanmahajan6129 Жыл бұрын
Bhaiya time to laga puri video dekhne m, but truely mazza bht aaya, and specially jo questions kr k confidence mila...🔥🔥🔥🔥, thank you bhaiya..!!!
@devvarshney1144
@devvarshney1144 2 жыл бұрын
Inplace solution of question "replace an space with @40" string replaceSpaces(string &str){ int l = str.length(); int i = 0; while(str[i] != '\0') { if(str[i] == ' ') { str = str.substr(0,i)+"@40"+str.substr(i+1,str.length()-1); } i++; } return str; }
@kenguvaabhinav2200
@kenguvaabhinav2200 Жыл бұрын
it should be substr(i+1,s.length()) as the end index is not inclusive, isn't it?
@akashpatel-jp4gh
@akashpatel-jp4gh 5 ай бұрын
Reverse words in a string we have to Change the position of word instead of reverse the word Example: "my name is love" Incorrect - "ym eman si evol" Correct - "love is name my" Like you helpful ❤
@tausifahmad2007
@tausifahmad2007 2 жыл бұрын
1:23:06 code:- string removeOccurrences(string s, string part) { //while(s.find(part)!=-1){ s.erase(s.find(part),part.size()); } return s; }
@jasonjackson8557
@jasonjackson8557 Жыл бұрын
can you pls explain? why -1?
@jaivishavbhaskar7776
@jaivishavbhaskar7776 23 күн бұрын
At 42:46 Question Valid Palindrome my approach is a lot more easier and i wuld say the best: class Solution { public: char tolowercase(char ch){ if(ch>='a' && ch
@rehanhussan
@rehanhussan 2 жыл бұрын
Sir Your teach us Like a Brother, Quality content and I follow all your words.
@arnobbaiga309
@arnobbaiga309 2 жыл бұрын
bro 1:47:28 why he did char[ansindex++]?
@BombSquadHindiTipsTricks
@BombSquadHindiTipsTricks Жыл бұрын
54:56 the question which Love Babbar bhaiyya is talking about is reverse word in a string III not II so guys search question no.557 in leetcode
@VishalGupta-xw2rp
@VishalGupta-xw2rp 2 жыл бұрын
Wow... This is just Gold 🔥🤩
@codedByAyush
@codedByAyush 6 ай бұрын
Wow Bhaiya, apne joh Palindrome ka approach bataya, woh toh akdam 🔥🔥 hai!
@aakashprajapati4836
@aakashprajapati4836 Жыл бұрын
Quality Content ++ ❤❤ Thank you sir for effort and time ur taking out for us 🔥🔥
@gurtegsinghsohi411
@gurtegsinghsohi411 Жыл бұрын
Can you provide answer of 57:15
@usernamewhatsoever4557
@usernamewhatsoever4557 2 жыл бұрын
Bhaiya aaj pehla question leetcode pe khud se solve kra, bahut garv mehsoos ho rha hai Aapke videos ne bohot help kari
@karthik53r35
@karthik53r35 2 жыл бұрын
1:39:08 Homework with Runtime: 85 ms, faster than 30.06% of C++ online submissions for Remove All Adjacent Duplicates In String. Memory Usage: 9.7 MB, less than 96.17% of C++ online submissions for Remove All Adjacent Duplicates In String. string removeDuplicates(string s) { int i=0,j=1; while(i0){ if(s[i]==s[j]){ while((i>0 && j
@parthhh3589
@parthhh3589 2 жыл бұрын
time complexity kya hai?
@mradultiwari9864
@mradultiwari9864 Жыл бұрын
@@parthhh3589 O(n square)
@mradultiwari9864
@mradultiwari9864 Жыл бұрын
string removeDuplicates(string s) { int i=0; while(i
@satyam8334
@satyam8334 Жыл бұрын
​@@mradultiwari9864 Try this:- class Solution { public: string removeDuplicates(string s) { int sl=s.size(); int i=0; while( i0) i-- ; sl=sl-2; } else{ i++; } } return s; } };
@mradultiwari9864
@mradultiwari9864 Жыл бұрын
@@satyam8334 thanks
@manashvardhan9965
@manashvardhan9965 Жыл бұрын
bhaiya is video ko ek hafte se padh rha hu samjh samjh kar😎 thankU
@jayeshmandavkar9837
@jayeshmandavkar9837 3 жыл бұрын
Attendance Marked Bhayya try to make videos till 1hr only because HW + attendance + Implementation is going beyond 3.5hrs going great in this course Hope we will be getting videos on daily basis...!! Thank You so much...
@HardikKrPatel
@HardikKrPatel 2 жыл бұрын
yes that's true✋
@SumitSingh-wz3wt
@SumitSingh-wz3wt 2 жыл бұрын
isme to 5 hour lag gaye
@munnakrish3572
@munnakrish3572 3 жыл бұрын
Replace string question string replaceSpaces(string &str){ // Write your code here. string temp = "@40"; for(int i = 0; i < str.size();i++){ if(str[i] == ' '){ str.replace(i,1,temp); } } return str; }
@rajkasat5804
@rajkasat5804 3 жыл бұрын
for adjacent duplicates: class Solution { public: string removeDuplicates(string s) { int j=0; int i=0; while(i+1
@sonicboom6635
@sonicboom6635 2 жыл бұрын
Thank you bro sharing this code
@raushansingh8618
@raushansingh8618 2 жыл бұрын
bro can u explain while(i+1
@aviralkumarsingh639
@aviralkumarsingh639 2 жыл бұрын
Ye lecture mera upr se gya 😵‍💫
@sureshbhardwaj9998
@sureshbhardwaj9998 3 жыл бұрын
Log kehte the aapko coding nhi aati roadmap dete ho. Job se nikal diya.. Kya tamacha maara sbke mooh pr aapne..well done Poori duniya me itna detailed content nahi h filhal
@hitececourses4062
@hitececourses4062 2 жыл бұрын
Replace Spaces: inplace solution string replaceSpaces(string &str){ for(int i=0; i
@prajjwalsingh2009
@prajjwalsingh2009 2 жыл бұрын
BRUH TOO GOOD
@visheshkumar15
@visheshkumar15 2 жыл бұрын
why 32 can u explain me plz
@prajjwalsingh2009
@prajjwalsingh2009 2 жыл бұрын
@@visheshkumar15 32 coz its the ascii value for space
@parthdeshwal4419
@parthdeshwal4419 10 ай бұрын
9 hrs lage khud question try karte hue is video ko dekhne me
@NamanSingh_142
@NamanSingh_142 11 ай бұрын
at 1:22:00,suppose there is no such part remaining in the string now,then .find() will return -1 and hence the condition becomes -1
@sunpreetsingh3797
@sunpreetsingh3797 2 жыл бұрын
Best solution to Remove all Adjacent Duplicates 1:39:00 void removeAdjacentDuplicates(string &str) { int i=0; while(str[i] != '\0') // OR we can use -> while( i
@gulmuazzamfaize6020
@gulmuazzamfaize6020 2 жыл бұрын
It's not working
@harmanjeetsingh4973
@harmanjeetsingh4973 2 жыл бұрын
@@gulmuazzamfaize6020 int i=0; while(i>=0&&s[i]!='\0'){ if(s[i]==s[i+1]){ s.erase(i,2); if(i!=0){ i--; } } else{ i++; } } return s; This will work. he missed when i=0; then i will be decremented to -1, so code was showing compilation error
@AyanSohail-oq7vk
@AyanSohail-oq7vk 2 ай бұрын
for Maximum occurring character solved using mapping with time complexity of O(n) and space complexity is O(1) which is the most optimal solution: the code is down below --> class Solution { public: char toLower(char ch){ if(ch>='A' && chmax){ max = it.second; maxchar = it.first; } //to handle characters lexiographically else if( it.second == max && it.first< maxchar){ maxchar = it.first;// s= 2 , t=2 , e=2; } } return maxchar; } hope this helps : -) .
Lecture 23: Introduction to 2D Arrays in C++ || LeetCode Questions
1:30:36
CodeHelp - by Babbar
Рет қаралды 646 М.
How I would learn Leetcode if I could start over
18:03
NeetCodeIO
Рет қаралды 739 М.
JISOO - ‘꽃(FLOWER)’ M/V
3:05
BLACKPINK
Рет қаралды 137 МЛН
«Жат бауыр» телехикаясы І 30 - бөлім | Соңғы бөлім
52:59
Qazaqstan TV / Қазақстан Ұлттық Арнасы
Рет қаралды 340 М.
She wanted to set me up #shorts by Tsuriki Show
0:56
Tsuriki Show
Рет қаралды 8 МЛН
УЛИЧНЫЕ МУЗЫКАНТЫ В СОЧИ 🤘🏻
0:33
РОК ЗАВОД
Рет қаралды 7 МЛН
LeetCode was HARD until I Learned these 15 Patterns
13:00
Ashish Pratap Singh
Рет қаралды 672 М.
The Dome Paradox: A Loophole in Newton's Laws
22:59
Up and Atom
Рет қаралды 981 М.
Watch this before you start Coding! 5 Tips for Coders
13:53
Apna College
Рет қаралды 322 М.
I Redesigned the ENTIRE YouTube UI from Scratch
19:10
Juxtopposed
Рет қаралды 819 М.
Lecture21: Solving LeetCode/CodeStudio Questions [Arrays]
33:32
CodeHelp - by Babbar
Рет қаралды 476 М.
How to Solve ANY LeetCode Problem (Step-by-Step)
12:37
Codebagel
Рет қаралды 327 М.
10 Math Concepts for Programmers
9:32
Fireship
Рет қаралды 2 МЛН
How I Mastered Data Structures and Algorithms
10:45
Ashish Pratap Singh
Рет қаралды 294 М.
I Solved 1583 Leetcode Questions  Here's What I Learned
20:37
ThePrimeTime
Рет қаралды 769 М.
JISOO - ‘꽃(FLOWER)’ M/V
3:05
BLACKPINK
Рет қаралды 137 МЛН