Lecture 10: Solving LeetCode/CodeStudio Questions [Arrays]

  Рет қаралды 1,347,871

CodeHelp - by Babbar

CodeHelp - by Babbar

Күн бұрын

Пікірлер: 2 500
@preetkatiyar969
@preetkatiyar969 2 жыл бұрын
If we get such teachers and such good explanation then no power in the world will stop me from going to product based company. Love u babbar sir and Thank u so so much.
@om-prakash-yadav
@om-prakash-yadav 2 жыл бұрын
jab job mil jaye to yahan reply kar dena... i am waiting ..
@preetkatiyar969
@preetkatiyar969 2 жыл бұрын
@@om-prakash-yadav kyu tu meri company me safai karmchari ki naukri karega kya
@kumargaurav9116
@kumargaurav9116 2 жыл бұрын
@@preetkatiyar969 Professionalism 100%.
@niteshsaxena3210
@niteshsaxena3210 2 жыл бұрын
well its not 100% true, this video is watched by over 250k people and I don't think so that even 1% of this number will get into FAANG as seats are limited, you should target startups also along with PBC
@preetkatiyar969
@preetkatiyar969 2 жыл бұрын
@@niteshsaxena3210 Why people Like you just spreading negativity , If you you don,t deserve or you are not able to grab oportunity or you can,t do it thats your falt so instead of doing this nonsense just say anyone can just because now days everyone is doing hardwork and giving his/her lots of efforts. You don,t know how these product Jobs are important for that person who is preparing day-night. SO PLEASE SHUT YOUR MOUTH. AND LET THEM CRACK EVERY COMPANY.
@RandomIndianStuff
@RandomIndianStuff Жыл бұрын
This video lecture series is seriously helping me to recollect my lost grounds once again. Can't thank you enough Love for these outstanding lectures. 🥺
@najafalibalti
@najafalibalti Жыл бұрын
I hope this message finds you well. I wanted to reach out and share my current learning journey in Data Structures and Algorithms (DSA). I've been dedicating time to learn from KZbin tutorials, but I'm facing challenges in tackling array duplication and occurrence questions.
@newhope5729
@newhope5729 Жыл бұрын
Brothers I wish to ask whether code studios support CPP STL or not because l have never been able to use it on Codestudios
@govindsuryavanshi6653
@govindsuryavanshi6653 Жыл бұрын
First I have completed all DSA series and now conclude this is Greatest ever DSA series to exist on youtube or paid courses. Your contribution will be remembered. You're God of DSA for us🙇‍♂
@umang_29
@umang_29 11 ай бұрын
bro do u have hand written notes?
@codingriovo631
@codingriovo631 10 ай бұрын
yes bro@@umang_29
@komalnagori280
@komalnagori280 Жыл бұрын
I don't usually do comments.. but for this playlist.. I couldn't stop myself.. the best playlist I can found is your... I tried multiple playlist for learning c++ and dsa but couldn't find the one who can teach as good as you do.. thank you so much bhaiya..
@narutodihargo
@narutodihargo Жыл бұрын
00:00 - Introduction 01:28 - Ques1 - Swap Alternates 02:49 - Promotion 03:53 - Example 07:03 - Implementation 10:58 - Dry Run again 13:23 - Swap Function breakdown 16:43 - Ques2 - Find Unique element 25:03 - Implementation 26:55 - LeetCode Homework 30:46 - Ques3 - Find Duplicates 36:21 - Implementation 38:38 - Homework 40:51 - Ques4 - Array Intersection 46:22 - Implementation 50:51 - Got TLE 51:18 - Optimisation 1 54:40 - Optimisation 2 01:01:28 - Ques5 - Pair Sum 01:03:43 - Implementation 01:10:06 - Dry Run 01:11:27 - Ques6 - Find triplets with given sum 01:14:53 - Ques7 - Sort 0 1 01:21:20 - implementation 01:33:23 - Homework
@rameshwari
@rameshwari 2 жыл бұрын
You're killing it🌟🌟 Keep posting till the end of the series.
@MrFaraziOfficial
@MrFaraziOfficial Жыл бұрын
lecture 9 and 10 notes - google drive drive.google.com/drive/folders/1xAtc-ETQdL8PqWWsbEslefKbue3zYEeE?usp=share_link
@rajbharati8952
@rajbharati8952 Жыл бұрын
@@MrFaraziOfficial thank you for your notes
@maheshsharma9695
@maheshsharma9695 2 жыл бұрын
I am working professional in one of the MNC and following your DSA course. You are providing good content with depth explanation. Keep doing great work. Thanks
@ritomukherjee8389
@ritomukherjee8389 2 жыл бұрын
26:18 (Brute force approach ): int findUnique(int *arr, int size) { //Write your code here for(int i = 0; i < size; i++) { int count = 0; for(int j = 0; j < size; j++) { if(arr[i] == arr[j]) { count++; } } if(count == 1) { return arr[i]; } } return -1; }
@lokeshmethani2656
@lokeshmethani2656 2 жыл бұрын
Bhai i or j kese zero se start kr skte ho glt h code
@shivprasadshinde2577
@shivprasadshinde2577 2 жыл бұрын
@@lokeshmethani2656 j ko I+1 se initial Krna hoga na bhai
@mr_pm_arena
@mr_pm_arena 3 ай бұрын
​@@shivprasadshinde2577bro tumne agar count =0 pakda hai toh j+1 nahi Kiya toh bhi chalega n
@cuteminired6550
@cuteminired6550 3 ай бұрын
Thanks 😊
@praveenwandhekar911
@praveenwandhekar911 28 күн бұрын
​@@lokeshmethani2656 Kyu nahi ho sakta ho sakta hai na
@AbhinavVeeramalla
@AbhinavVeeramalla Жыл бұрын
bhaiya it would be helpful if you could provide answers to homework questions because the answers that are in internet seems to be not optimized and doesn't relate to the context you are setting like in that question to find unique number of ocurences there is only brute force solution in arays and solution with hash map. there is no solution as which you have to said it can be optimized. can you please add solutions from your side too. it would be quite helpful
@prasadcode58
@prasadcode58 Жыл бұрын
I am now clearly understanding about arrays, even I also learned about vectors and its methods, thanks guruji!!! ❤
@MrFaraziOfficial
@MrFaraziOfficial Жыл бұрын
lecture 9 and 10 notes - google drive drive.google.com/drive/folders/1xAtc-ETQdL8PqWWsbEslefKbue3zYEeE?usp=share_link
@GauravSingh-e5e1p
@GauravSingh-e5e1p Жыл бұрын
@@MrFaraziOfficial hey can you provide me link of complete dsa course by love babbar
@najafalibalti
@najafalibalti Жыл бұрын
I hope this message finds you well. I wanted to reach out and share my current learning journey in Data Structures and Algorithms (DSA). I've been dedicating time to learn from KZbin tutorials, but I'm facing challenges in tackling array duplication and occurrence questions.
@ayushkushwaha171
@ayushkushwaha171 2 жыл бұрын
For "Array Intersection" question, I was able to think of brute force (n^2) solution in my head alone & then I was able to find your optimised solution 2, without even watching that part in the video!! Really happy feeling that I am getting in there slowly because of these tutorials!! Thanks Bhaiya ❤️🎉🔥
@arjunyadav-kt5jr
@arjunyadav-kt5jr 2 жыл бұрын
what is your progress now
@itsmeakash_
@itsmeakash_ Жыл бұрын
Progress?
@MrFaraziOfficial
@MrFaraziOfficial Жыл бұрын
lecture 9 and 10 notes - google drive drive.google.com/drive/folders/1xAtc-ETQdL8PqWWsbEslefKbue3zYEeE?usp=share_link
@truptichoudhary9466
@truptichoudhary9466 Жыл бұрын
@@MrFaraziOfficial Thanks So much your notes are very much helpfull for me
@aditibandewar1649
@aditibandewar1649 4 ай бұрын
​@@MrFaraziOfficial age ke notes kaha hai
@raghavsinghal22
@raghavsinghal22 2 жыл бұрын
I don't understand the problem of a unique number of occurrences because all are using maps and all.
@SaurabhKumar-ck7yb
@SaurabhKumar-ck7yb 2 жыл бұрын
#include using namespace std; bool myfunc(int a[]){ for(int i = 1; i
@kanikagupta2806
@kanikagupta2806 2 жыл бұрын
@@SaurabhKumar-ck7yb ty for this
@rameshmalhotra9525
@rameshmalhotra9525 2 жыл бұрын
kzbin.info/www/bejne/qnK0en6bZbp6fpY
@ronitsingh5926
@ronitsingh5926 2 жыл бұрын
Bhai ye O(n) me kaha hoo raha h ?
@amarjeetyadav26436
@amarjeetyadav26436 2 жыл бұрын
@@SaurabhKumar-ck7yb ye kya hua
@amankumbhalwar
@amankumbhalwar 2 жыл бұрын
जो कठिनाईयों से सीखता है, वही आसानी से समझा सकता है । जय श्री कृष्ण ❤🙇‍♂️🙏
@Op-fire-qq8xl
@Op-fire-qq8xl 2 ай бұрын
Swap alternate start=0; end=1; While(end
@Master-sy8si
@Master-sy8si 2 жыл бұрын
Bro, thanks for the video!! It's great that you haven't deleted/cut the video parts where you have made mistakes in the logic. Due to this we are also learning "how to debug our code". It's really helpful man! Thanks a lot Love!!
@aryanisgood
@aryanisgood Ай бұрын
39:25 we can also do this question by adding all numbers from 1 to N-1 and then subtracting it with sum of array, it will give us the repeating number
@siddhant2943
@siddhant2943 Жыл бұрын
For loop approach to swap alternate elements of an array(works for both odd and even size arrays) for(int i=0; i+1
@movieBOY2003
@movieBOY2003 Жыл бұрын
thanks bhai
@mmujtabah
@mmujtabah 2 күн бұрын
what about this solution isn't this more optimal since we are iterating to less than 1 size for (int i = 0; i < size - 1; i+=2) { swap(arr[i], arr[i + 1]); }
@k.pavansai3056
@k.pavansai3056 2 жыл бұрын
Please Explain Hash Maps. This is being used to solve many questions including The LeetCode's Find unique occurrences
@kishanprajapati6927
@kishanprajapati6927 2 жыл бұрын
yes bro did find the solution of unique occurence question without using hash map if you please can you submit that in discord 7-10 lec server .
@kishanprajapati6927
@kishanprajapati6927 2 жыл бұрын
yes bro did find the solution of unique occurence question without using hash map if you please can you submit that in discord 7-10 lec server .
@rameshmalhotra9525
@rameshmalhotra9525 2 жыл бұрын
kzbin.info/www/bejne/jpPEcmRjd65gsNk
@piyushsinha9989
@piyushsinha9989 2 жыл бұрын
duplicates in an array {1,2,3,4,.....x..........N-1, x} how 2nd x came after N-1 if N-1 is the last element of the array
@Rutik9999
@Rutik9999 2 жыл бұрын
@@piyushsinha9989 he is not talking about index, he is just explaining in terms of values
@manishbulchandani8306
@manishbulchandani8306 Жыл бұрын
a better approach to solve at 38:10 is // Write your code here int N=arr.size(); int sum=0; for(int i=0;i
@AmanSingh-cc2ci
@AmanSingh-cc2ci Жыл бұрын
Nhi chla bhai Tera bhi code🥴
@rahul_kumar_bhagat
@rahul_kumar_bhagat Жыл бұрын
@@AmanSingh-cc2ci yaha n-1 ke jagh pe n+1 laga ke dekho
@animeshsahoo-yo1tt
@animeshsahoo-yo1tt 4 күн бұрын
bruh formula to shi se laga de
@robinofautumn99
@robinofautumn99 Жыл бұрын
31:00 homework--> duplicates in an array int findDuplicate(vector &arr) { int m[arr.size()]={}; for(int i=0; i1) return arr[i]; } } O(n)--> time complexity O(n)--> space complexity
@abhishekverma1528
@abhishekverma1528 2 жыл бұрын
Bhaiya "we are ready for continuous lecture" bas 3-4 month me khatm kara do with quality content . Jai hind. Dhanywaad bhrata shree 💙
@vitragrathi6522
@vitragrathi6522 2 жыл бұрын
duplicte element:- int findDuplicate(vector &arr) { // Write your code here int n=arr.size(); int sum1=0; int sum2=0; for(int i=0;i
@sagarbgmi5337
@sagarbgmi5337 2 жыл бұрын
nice buddy
@dikshajain9845
@dikshajain9845 2 жыл бұрын
Homework: 1. Unique Number of Occurrences bool uniqueOccurrences(vector& arr) { int n = arr.size(); unordered_map m; for(int i=0;i
@deepak_chourasiya2110
@deepak_chourasiya2110 2 жыл бұрын
Help me plz
@sowtheshv9904
@sowtheshv9904 Жыл бұрын
sort function in finding duplicates uses time complexity of nlogn
@hardikparmar4180
@hardikparmar4180 10 ай бұрын
pr bhai ye sab concept to abhi tak sikhaye hi nay
@AtharvGupta098
@AtharvGupta098 7 ай бұрын
@@hardikparmar4180 exactly, koi simplier solution mila?
@hardikparmar4180
@hardikparmar4180 7 ай бұрын
@@AtharvGupta098 nope
@kunalprakash7826
@kunalprakash7826 Жыл бұрын
For swapping adjacent element I initialized i with 1. it help to remove if condition. for(int i = 1; i < size; i = i+2){ swap(arr[i], arr[i-1]); }
@rupeshkarki6145
@rupeshkarki6145 Жыл бұрын
nice
@changed217
@changed217 Жыл бұрын
Quite tough of a lecture, for me at least, thank you for teaching with such patience.
@fuasteriskk
@fuasteriskk Жыл бұрын
it was damn tough didn't understand much
@newhope5729
@newhope5729 Жыл бұрын
Brothers I wish to ask whether code studios support CPP STL or not because l have never been able to use it on Codestudios
@saadtariq1199
@saadtariq1199 11 ай бұрын
yaar damn tough this lecture was..
@primeop8576
@primeop8576 8 ай бұрын
@@newhope5729 just include the library stdc bro it will work
@VishalKumar-lk1pt
@VishalKumar-lk1pt 7 ай бұрын
Quite😢
@soham_mondal
@soham_mondal 2 жыл бұрын
23:10 How the xor operator works? Specially with integers 26:55 39:38 How to do it? 1:33:33
@hum__shyam
@hum__shyam 2 жыл бұрын
Bro watch previous video!
@brayansaldanha8358
@brayansaldanha8358 2 жыл бұрын
In the sorting 0,1 question , we don't need two while loops. I think this is a better optimized solution : void sort_01(int a[] , int n){ int low = 0; int high = n-1; while(low
@najafalibalti
@najafalibalti Жыл бұрын
I Finally complete this video in around 4 to 5 complete day. just because i am using c to acheive my result. But this teacher is really Great Appreciated ! ❣❣ Love From Pakistan
@yashendrabadal4776
@yashendrabadal4776 Жыл бұрын
use c++ bro
@parthagarwal3522
@parthagarwal3522 4 ай бұрын
Thanks bhaiya. I am starting coding at my 3rd year's end and I cannot tell you how grateful I am that I have this playlist.
@tomiokascuteness1909
@tomiokascuteness1909 Жыл бұрын
(I traversed through array and compared each element with the others and checked if they are equal made them 0 and printed the non zero element) I know time complexity is going harsh but just another approach int findUnique(int *arr, int size) { //Write your code here for(int i=0;i
@shaktawatrinku141
@shaktawatrinku141 Жыл бұрын
thanks for this solution :)
@cuteanime2
@cuteanime2 2 жыл бұрын
bhaiya, one of the best video i've ever seen on array questions. and the way you solve the problems using different approaches is next level. you are the best. and thank you so much for such a helpfull series.
@ritomukherjee8389
@ritomukherjee8389 2 жыл бұрын
1:33:57 (3 pointer solution with O(n) Time complexity ): #include void sort012(int *arr, int n) { // Write your code here int i = 0; int mid = 0; int k = n - 1; while ( mid
@avinash__02_
@avinash__02_ 2 жыл бұрын
is mid =n/2 ?
@priyanshumahukhaye6282
@priyanshumahukhaye6282 Жыл бұрын
@@avinash__02_ no
@vineetgupta6813
@vineetgupta6813 Жыл бұрын
what is mid and how you assigned it? is it a value or have you given starting index(0) two different name one is i and the other one is mid??
@ameykinjalkar1424
@ameykinjalkar1424 Жыл бұрын
@@vineetgupta6813 hey, he has taken "mid" as in "j" and it has the starting index of 0 just like "i" and basically we're checking when this pointer in the array comes across "0", "1" or "2" then different cases are getting executed. Like if we found 0, swap it with the left most pointer "i" (since the order of the sort is 0..,1..,2..) then increment "i" and "j". Then if we found 1, let it be at it's place and increment j and if we found 2, then swap it with the right most pointer "k" and decrement k. This way we're sending all 0's to the left most end, keeping the 1's in the middle and sending all 2's to the right most end. Hope this helps :)
@ALOKKUMAR-qj2bw
@ALOKKUMAR-qj2bw 2 жыл бұрын
Watched till end and after 2 month I am solving this much question and proper set of question( level wise problem). All because of you #Lovebabbar ☝️☝️🙏
@saurabhfreefire2205
@saurabhfreefire2205 Жыл бұрын
Can I Connect With You
@khatariinsaan5284
@khatariinsaan5284 Жыл бұрын
@ROCKSTAR GAMES VI Can I connect with you...
@nikhill0411
@nikhill0411 Жыл бұрын
@@khatariinsaan5284 Can I connect with you....
@newhope5729
@newhope5729 Жыл бұрын
@@nikhill0411 Can I connect with you.....
@itzmranonymous
@itzmranonymous Жыл бұрын
@@nikhill0411 Can I connect with you.....
@_Itachiii
@_Itachiii 11 ай бұрын
to swap alternate elements in an array we can use a single loop for both even and odd sized arrays i thought this logic and it works very well for(int j=0; j
@devanshuu
@devanshuu 11 ай бұрын
it wont work for even sized arrays
@_Itachiii
@_Itachiii 11 ай бұрын
@@devanshuu it is working
@mmujtabah
@mmujtabah 2 күн бұрын
@@devanshuu it works for both even & odd
@ellis-pr7hh
@ellis-pr7hh 2 жыл бұрын
HOMEWORK QUES 2) Find All Duplicates in an Array vector findDuplicates(vector& nums) { vectorv; sort(nums.begin(), nums.end()); for(int i=0; i
@anikettripathi9238
@anikettripathi9238 2 жыл бұрын
Leetcode wala problem that u gave as homework, can it be done without using maps and hashing. but I haven't studied that part and I'm finding it hard to code using arrays only....... I'll be thankful to anyone who can refer a solution video or article that is understandable.
@itsengineer3263
@itsengineer3263 2 жыл бұрын
class Solution { public: bool uniqueOccurrences(vector& arr) { vector ans; int n = arr.size(); int x[n]; for(int i =0;i=0;z--) { if(arr[i]==arr[z]) { check++; break; } } if(check!=0) { continue; } int count=1; for(int j=i+1;j
@debaroonniyogi7629
@debaroonniyogi7629 2 жыл бұрын
Hi, I too had the problem so I made the program with only arrays like you want. It's complexities are a bit high but without hashing, it can't be optimized further. Reply if you find it useful ! bool uniqueOccurrences(int* arr, int arrSize) { int i, j, arr1[arrSize], k; int n = arrSize, count=0; //Initializing the arr1 with -1 for(i=0; i
@sarveshkulkarni6287
@sarveshkulkarni6287 2 жыл бұрын
@@debaroonniyogi7629 class Solution { public: bool uniqueOccurrences(vector& arr) { int ct[1000]={0}; int n=arr.size(); for(int i=0;i
@debaroonniyogi7629
@debaroonniyogi7629 Жыл бұрын
@@niteshsaxena1066 leetcode will not pass it. The test cases there will not be satisfied unless you use hashing. I gave this without hashing. You can try in your own local compiler and check out
@ananwitasarkar9331
@ananwitasarkar9331 2 жыл бұрын
@CodeHelp - by Babbar bhaiya please... h/w problems ke ek solution sheet attach kar dijiyega at the end of the video... Or Atleast, kese uss problem ko approach kare...( i mean your kinda optimised approach 🥺🥺) It will be very helpful. :-) As I always keep wondering whether my approach is the optimised one or if there is any other better approach that you have thought of....
@mohitdodeja6688
@mohitdodeja6688 2 жыл бұрын
Hey do you have your approach as I'm really stuck at h/w questions for nearly day.. if possible please do help.
@mdfarhanali305
@mdfarhanali305 2 жыл бұрын
@@mohitdodeja6688 I also got stuck in homework questions
@mohitdodeja6688
@mohitdodeja6688 2 жыл бұрын
@@mdfarhanali305 Hey go to discord there are some really good people they would help you with the problem...to go number (the lec number you are on) channel and post your doubt you will get your answers
@ritikagrover2724
@ritikagrover2724 2 жыл бұрын
01:14:53 - Ques7 - Sort 0 1 🔸void sort_01(int arr[], int n) { int i = 0, j = n - 1; while(i
@YugiPlayz
@YugiPlayz Жыл бұрын
Sahi... andar loop lagane ka zarurat nahi hai!
@travelvlogs1972
@travelvlogs1972 8 күн бұрын
@@YugiPlayzi also thought why loop inside while , we can check it with if else
@ShiwanaGhai
@ShiwanaGhai 3 ай бұрын
I love that you explain everything two times atleast. Thank you!
@mdwaqar7401
@mdwaqar7401 Жыл бұрын
Finally After 4 Days of Watching and Understanding this video and doing the Problems by myself I completed this Video. I understood a Great Deal. Also the Last Problem that you showed with 2 While Loops Sorting 0's and 1's Sorting Problem. I did it with just one While Loop and it works. int i = 0; int j = size-1; while (i
@newhope5729
@newhope5729 Жыл бұрын
bhai ye maine code likha 30:43 par question Find duplicates ka: int findDuplicate(vector &arr) { set s; for(auto i:arr) { if(s.count(arr[i])==1) return arr[i]; else s.insert(arr[i]); } // Write your code here } par ye error de rha Codestudio : Compilation Failed In file included from runner.cpp:9:0: solution.h: In function 'int findDuplicate(std::vector&)': solution.h:3:5: error: 'set' was not declared in this scope set s; ^ solution.h:3:9: error: expected primary-expression before 'int' set s; ^ solution.h:6:12: error: 's' was not declared in this scope if(s.count(arr[i])==1) ^ Bhai merko aap bta sakte hain ki kya ye codestudio stl functions accept nahi karta kya?? Because is se pahle "Find Unique" waale question me bhi binary_search function ko problem bataa rha tha....... Please help I request you bhaiya ji 🙏🙏🙏🙏 I'll be very grateful 🙏🙏🙏🙏
@ankitkeshri9153
@ankitkeshri9153 2 жыл бұрын
This is the best course I have ever seen. I appreciate your hard work Bhaiyaa. ❤
@munnakrish3572
@munnakrish3572 2 жыл бұрын
sort 0 1 2 //Solved in two pass manner.Although I think it runs in linear time. //The main idea is to swap the positions of 0 and 2 in correct order!!. void sort012(int *arr, int n) { // Write your code here int firstValue = 0; int thirdValue = 2; int firstIdx = 0; for(int i = 0; i < n;i++){ if(arr[i] == firstValue){ swap(arr[i],arr[firstIdx]); firstIdx++; } } int thirdIdx = n - 1; for(int i = n - 1; i >= 0;i--){ if(arr[i] == thirdValue){ swap(arr[i],arr[thirdIdx]); thirdIdx--; } } }
@sambhavsharma2780
@sambhavsharma2780 2 жыл бұрын
Nice Approach bro 👌
@jawhoralikhan2541
@jawhoralikhan2541 2 жыл бұрын
Bhaiya aise hi darshate rahiye❤❤❤
@juniorgaming5874
@juniorgaming5874 Жыл бұрын
alternate solution of pair sum - in pair sum problem if you sort the input vector "arr" you didn't have to do the min and max part vectorans; sort(arr.begin(),arr.end()); for(int i=0;i
@ashishpandey2002
@ashishpandey2002 Жыл бұрын
Aapki videos bohot simple and straight forward hoti hai aapka language ekdum synchronized feel hota hai at the end maza ata hai🙏🙏♥♥
@AayushGoyal
@AayushGoyal 2 жыл бұрын
For swapping alternate elements: void swapAlt(int arr[], int size){ int a=0,b=1; while(b
@deepakkansal9112
@deepakkansal9112 Жыл бұрын
mne b ese hi try kiya
@rishabjha2003
@rishabjha2003 Жыл бұрын
At 1: 11 08 pr loop n-1 tak kyu chal rha hai sir
@anshbhatia9823
@anshbhatia9823 2 жыл бұрын
Another method for alternate swap(without using if condition): void alternateSwap(int arr[], int size){ for(int i = 0; i
@okaybossiamonyoutubeakkskd
@okaybossiamonyoutubeakkskd 2 жыл бұрын
( i < size -1 ) and ( i + 1 < size ) are literally the same thing. don't call this as a "method"
@kankanaki4368
@kankanaki4368 2 жыл бұрын
you can also solve array interaction question: vector findArrayIntersection(vector &arr1, int n, vector &arr2, int m) { int i=0,j=0; vector ans; while(i
@kushalshivhare4366
@kushalshivhare4366 Жыл бұрын
but isme agar 2 do baar aa rha hai dono array mein to 2 do bar print hoga......but hme to unique print krna h vo kse kre?
@no_1313
@no_1313 Жыл бұрын
@@kushalshivhare4366 Do bar aye to do bar he hoga, unique element wise dekhna hai, ek pair dubara use nahi hoga
@itzmranonymous
@itzmranonymous Жыл бұрын
thanks i was doing a silly mistake as i am new to c++ and just now learnt about vector and your code solved it , i cant believe i was wasting so much time searching for error :( . Thanks a lot keep posting codes like this
@shindeshankar5022
@shindeshankar5022 8 ай бұрын
Bhaiya , in swap alternative question we can apply condition in loop if(i%2!=0) then swap i with i-1 and get the output for both even and odd array😀
@lekhanachidananda
@lekhanachidananda 9 ай бұрын
Find Unique element in the array(my approach): int findUnique(int *arr, int size) { for(int i=0;i
@vikasyadav-vq2fu
@vikasyadav-vq2fu Жыл бұрын
Thank you so much Babbar bhaiya !! For providing your precious knowledge here, so glad to learn this.
@amarnathprajapati2543
@amarnathprajapati2543 2 жыл бұрын
Completed such a amazing session with honesty.
@bhaveshs1745
@bhaveshs1745 2 жыл бұрын
Thank you so much for this series Bhai 🔥 Har video ke saath excitement badhte hi jaa rahi hai ab 💯
@visheshkaran7083
@visheshkaran7083 2 жыл бұрын
True
@akshitamishra18
@akshitamishra18 6 ай бұрын
bhaiyaa abhi tak ka phla video arrays ka jo samajh ayyaaa.....Thankyou so much
@pratik4080
@pratik4080 3 күн бұрын
love you
@rockycinema2499
@rockycinema2499 Жыл бұрын
Ha bhai mene 1h 40 m 13 se ki to nhi par 1:34:54 ki video puri dekli Or ise pura dekhne me mujhe 10 hour lag gye kyoki aapke questions solve karane se pahle 1/2 ek ghanta mene try kiya phir video phir try
@adarshpandey2515
@adarshpandey2515 2 жыл бұрын
Intersection of arrays vector findArrayIntersection(vector &arr1, int n, vector &arr2, int m) { // Write your code here. vector ans; int i=0 ; int j=0; while(i
@onkarlapate27
@onkarlapate27 2 жыл бұрын
Thanks for giving homework questions on leetcode!!
@mehaksharma9391
@mehaksharma9391 2 жыл бұрын
did uh find the soln of unique occurence ques...without hasmaps
@garvgupta4219
@garvgupta4219 8 ай бұрын
Sir homework problems bina brute force ke solve nahi ho rahe and leetcode ke discussion forum main aage ke concepts se solve kar rakhe hain problems, how to find the solutions of these problems?
@MohdSaifEC
@MohdSaifEC 7 ай бұрын
Maine XOR karke kara tha question toh 54/69 testcases pass hue submit he ni ho rha h...
@pratyakshdixit7576
@pratyakshdixit7576 5 ай бұрын
@@MohdSaifEC Solution bhej sakte ho bhai
@MohdSaifEC
@MohdSaifEC 5 ай бұрын
@@pratyakshdixit7576 bro dhundna pdega yaar...
@chinmayeemohapatra9233
@chinmayeemohapatra9233 Жыл бұрын
mazaa aaraha hai question solve krne me... 10 baby steps ✅... More ahead to complete🔥
@funlearning5989
@funlearning5989 6 ай бұрын
video completed.... consistency is power...lets see the magic
@hermionegranger6493
@hermionegranger6493 2 жыл бұрын
Enjoying this series!Amazing work!
@awais_ansarii
@awais_ansarii 2 жыл бұрын
Such a Great Session Sir❣️ Enjoying watching the entire playlist... Huge Respect ❣️
@MrFaraziOfficial
@MrFaraziOfficial Жыл бұрын
lecture 9 and 10 notes - google drive drive.google.com/drive/folders/1xAtc-ETQdL8PqWWsbEslefKbue3zYEeE?usp=share_link
@sanajitbhunia688
@sanajitbhunia688 Жыл бұрын
Sir, please provide the answers to LeetCode homework problems as it will help us find accurate solutions.
@KrishnaGupta-bp1ny
@KrishnaGupta-bp1ny 9 ай бұрын
get in leetcode discussion section
@niveshkothari
@niveshkothari 9 ай бұрын
​@@KrishnaGupta-bp1ny Where?? Discord ?m
@Mohan_lal_gupta
@Mohan_lal_gupta 9 ай бұрын
​@@niveshkothari In question screen, you will get on the top named *solution*
@motivation_with_harsh
@motivation_with_harsh 4 ай бұрын
Unique Occurance of Element in the Array class Solution { public: bool uniqueOccurrences(vector& arr) { unordered_map m; for(int i = 0 ; i < arr.size() ; i++){ m[arr[i]]++; } unordered_set s; for(auto pair : m){ s.insert(pair.second); } return m.size() == s.size(); } };
@PrankurGarg
@PrankurGarg Жыл бұрын
In pair sum question, if we take input as 4 2 1 1 1 1 Here, four elements in array and pair sum should equals to 2. Output should be : (1,1) (1,1) But by the above approach the output is (1,1) (1,1) (1,1) (1,1) (1,1) (1,1) .
@sakshibhokare5630
@sakshibhokare5630 2 жыл бұрын
You are fantastic bhaiya💖 I got my interest in coding just because of you!!! thank you so much 😊
@mahekhingorani7963
@mahekhingorani7963 3 ай бұрын
tough lecture :(
@sounaksaha1455
@sounaksaha1455 2 жыл бұрын
2 days late, but still watched the whole video in one shot. Thanks bhaiya for providing such quality content. We are grateful to you.
@YashKumar-ww4sg
@YashKumar-ww4sg Жыл бұрын
First of all thank you sir providing a great content for free of cost with detailed depth analysis of topics and question. Sir I have a question that in Sort 0 1 question that if we are using in first while loop that left
@MehakMalhotra-bj2ce
@MehakMalhotra-bj2ce 3 ай бұрын
leetcode homework question at 27:15 Unique Number of Occurences class Solution { public: bool uniqueOccurrences(vector& arr) { sort(arr.begin(), arr.end()); vector count; int num= 1; int s= arr.size(); for(int i=0; i
@amigoplayz3099
@amigoplayz3099 3 ай бұрын
thanks brother. helped a lot. solved my 1st problem.
@tusharrathore2610
@tusharrathore2610 2 жыл бұрын
Unique Number of Occurrences : Solution(Using only Arrays): sort(arr.begin(),arr.end()); vector v; int num = 0; for (int i = 0; i
@YogeshBora07
@YogeshBora07 Жыл бұрын
do i need to learn STL for these questions ?
@harshitchaubey8274
@harshitchaubey8274 2 жыл бұрын
Bahut sahi Bhaiya maza aaya🔥 Bus coding part samajne me thodi mushkil ho rahi he.... Algo you are teaching awesome Please focus more on code explaination 🙏 How code is working
@infernogamer52
@infernogamer52 Жыл бұрын
COMPLETED AT 08:39 ON 15-12-2022 LIKED IT VERY MUCH NEXT TARGET: LEC #11
@KritiYadavcoding
@KritiYadavcoding 4 ай бұрын
Isse dekhne mei 3 din lgg gyaa .may be thoode new concept aur questions thee iss liye but now its time to buckle up
@adityasahni5262
@adityasahni5262 Жыл бұрын
1:15:44 By counting num of 0s and 1s in 1 traversal and then updating values of array in 2nd traversal. Complexity will be O(2n) = O(n) Code: #include void sort012(int *arr, int n) { int num0 = 0, num1 = 0; for(int i = 0; i
@AVINASHKUMAR-fk6sk
@AVINASHKUMAR-fk6sk 2 жыл бұрын
for the unique number problem we can also subtract the sum of the array from sum of numbers from 1 to n-1
@ayushpal4389
@ayushpal4389 5 ай бұрын
nice approch
@khemchand6431
@khemchand6431 Жыл бұрын
we are living in a good area as we can consume these kind of content free of cost without giving a single ruppee thank you so much babbar bhiaya huge respect to you
@amaanahmad1693
@amaanahmad1693 Жыл бұрын
era*
@kankanaki4368
@kankanaki4368 Жыл бұрын
you are giving money for internet
@apoorvasunkad6686
@apoorvasunkad6686 2 жыл бұрын
These videos are really helpful 👍🤗 Thank you for the Course 😀
@kartikbathla2030
@kartikbathla2030 Жыл бұрын
Love bhaiya @8:18 swaping alternate terms questions what if we first analyse that the given arrays is odd or even and then we write for loop separately..... The code for this situation would be as- # include using namespace std; int main(){ int n; cin>>n; int arr[n]; for(int i=0; i>arr[i]; } int k=(n-1); if(n%2==0){ for(int i=0; i
@mridulabanarjee4313
@mridulabanarjee4313 2 жыл бұрын
Great explanation , first time getting confidence in solving questions. Thank you so much ❤❤
@AnirudhVishwakarma-e2u
@AnirudhVishwakarma-e2u Жыл бұрын
homework kuch jyada tough nhi hai🥲🥲mujhe to solve karte karte rona aa rha hai
@exploringme278
@exploringme278 Ай бұрын
😢
@soniasaleem3880
@soniasaleem3880 15 күн бұрын
H.w easy b ho tough lgta ha bro 😂 q k khd krna prta ha
@Corporate_slaves
@Corporate_slaves Жыл бұрын
kya yha pr akela mai hi hun jo solution dekhne ke baad bhi khud se try kr rha h fir bhi answer galat jaa rha h
@dnspavankumar695
@dnspavankumar695 2 ай бұрын
Yes
@taranggupta1127
@taranggupta1127 2 ай бұрын
nhi yaar , hota h
@hinduism4087
@hinduism4087 2 ай бұрын
Galat nahi ja raha logic hi galat ho ja raha hai
@shagunkumarrosawan9410
@shagunkumarrosawan9410 Ай бұрын
Sahi ma bhai
@construction.life1625
@construction.life1625 Ай бұрын
Nahi yar mujhse bhi nahi ho rha, mujhe lagta hai ki inka function inbuilt hai, aur ham sahi se function nahi use kar pa rhe hai
@sumanjangid9306
@sumanjangid9306 Жыл бұрын
Solution of find all Duplicates in an array by hashmap class Solution { public: vector findDuplicates(vector& nums) { vector ans; int n = nums.size(); vector hash(n + 1, 0); // Initialize a hash array of size n+1 with all elements set to 0 for (int i = 0; i < n; i++) { hash[nums[i]]++; // Increment the count for the corresponding number in the hash array } for (int i = 1; i 1) { ans.push_back(i); // If the count is greater than 1, add the number to the result vector } } return ans; } };
@umangpatel8507
@umangpatel8507 2 жыл бұрын
Duplicates in Array Problem You used two for loops for finding array xor and xor of 1 to n-1 Can we used one loop Like This :--- int ans = 0; for(int i = 0; i < arr.size();i++){ ans = ans^arr[i]^ i; } return ans; ans^arr[i]^ i; we know that for we run from i to n-1 only so why not calculated in single for loop all AT ONCE .
@sameershah1492
@sameershah1492 Жыл бұрын
Bhaiya just becouse of you im placed in MicroSoft
@sumitkumbhkarn
@sumitkumbhkarn 10 ай бұрын
solution at 37:42 doesn't work for test cases like [2,2,2,2,2]
@inbuiltengineer836
@inbuiltengineer836 8 ай бұрын
unique element ko maine try kiya aur kar bhi liya aur usme maine 50 line ka code likha aur bhai ne 3 line me khatam kar diya
@mahigour7124
@mahigour7124 Жыл бұрын
Swap alternate different method:- for (int i = 0; i < size-1; i+=2) { swap(arr[i],arr[i+1]); }
@faysalmahmud2721
@faysalmahmud2721 Жыл бұрын
#include using namespace std; int main() { int size, sum = 0; cin >> size; int arr[10]; for(int i=0; i> arr[i]; sum += arr[i]; } cout
@LifeStoryAshita
@LifeStoryAshita 2 жыл бұрын
Your way of teaching is truely awesome, the only thing i would request is to please upload video lil fast or on daily basis, if is possile!! vo editing vale bhiaya aa gye na to please!!
@CodeHelp
@CodeHelp 2 жыл бұрын
Next 7 days 7 videos
@LifeStoryAshita
@LifeStoryAshita 2 жыл бұрын
@@CodeHelp 🤩 wow Thank Thank You so much
@chitranshverma1822
@chitranshverma1822 5 ай бұрын
Bhaiya Leetcode ke homework questions toh bilkul bhi nai bn rahe ....pls guide,,.... discussion is soo difficult... somebody pls help
@pranavpatil4095
@pranavpatil4095 4 ай бұрын
bhai pehela HW question me to hash map use karna hai aab mujhe bas hash map kya hota hai kaise kam karta hai pata hai baki kaise use karna hai pata nahi to thoda confusion ho raha hai baki jo aab tak sikhaya hai use solution nahi ban raha hai HW wale question ka ;_;
@Saurabh-gg9lv
@Saurabh-gg9lv 2 жыл бұрын
SOLUTIONS 1. class Solution { public: bool uniqueOccurrences(vector& arr) { unordered_mapmp; for(int i=0;i
@asharma741
@asharma741 Жыл бұрын
for swapping elements I removed the if condition and instead, added the condition in for loop. for (int i = 0; (i < size & i + 1 < size); i += 2) { swap(arr[i], arr[i + 1]); }
@tejashmaurya2149
@tejashmaurya2149 Жыл бұрын
Find all duplicates class Solution { public: vector findDuplicates(vector& nums) { vector ans; sort(nums.begin(),nums.end()); for(int i=0;i
@yashdeshmukh8853
@yashdeshmukh8853 2 жыл бұрын
Pataa nhi questions easy hogaye ya mujhe lag rahe 😅 Shayd sikhane wale ka kamaal hoga 😁 Op bhaiya 🔥🔥
@surendrajat7290
@surendrajat7290 Жыл бұрын
i can't express my self , thank you for such videos sir .
@leoxse
@leoxse 4 ай бұрын
Sir I can you explain me what is vector ?
@satvikchauhan85
@satvikchauhan85 11 ай бұрын
Just one thing I noticed At 50:51 When we got TLE for firs time the runtime is 4944ms and after putting only one condition at 53:29 [ele
@rohitkhatri3892
@rohitkhatri3892 8 ай бұрын
Question 3 can also be done by summing all the elements of the array and then subtracting the sum of first n-1 integers
@033_rajatsingh2
@033_rajatsingh2 Жыл бұрын
Most of the questions are based on vectors so should id do these questions after learning the STL for better understanding?
Lecture 11:Time & Space Complexity || How to avoid Time Limit Exceeded [TLE]
29:12
IIT-JEE Toppers: Where Are They Now?
16:07
Mohak Mangal
Рет қаралды 1 МЛН
Win This Dodgeball Game or DIE…
00:36
Alan Chikin Chow
Рет қаралды 34 МЛН
How I would learn Leetcode if I could start over
18:03
NeetCodeIO
Рет қаралды 543 М.
My Brain after 569 Leetcode Problems
7:50
NeetCode
Рет қаралды 2,6 МЛН
Lecture 12: Binary Search Explained in 1 Video [Theory + Code]
38:41
CodeHelp - by Babbar
Рет қаралды 854 М.
LeetCode was HARD until I Learned these 15 Patterns
13:00
Ashish Pratap Singh
Рет қаралды 360 М.
how to study less and get higher grades
11:16
Gohar Khan
Рет қаралды 171 М.
Harsh Truth of Java in 2024! Ft. Ultimate Java Developer @Telusko
28:46