Solving Arrays Questions | Find duplicates in an array | GeeksForGeeks | Nishant Chahar Ep-18

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 พ.ย. 2024

ความคิดเห็น • 119

  • @HarshSharma-ib8ft
    @HarshSharma-ib8ft 2 ปีที่แล้ว +3

    Day 43
    Find Duplicates In An Array
    Every day, you strengthen and become even more perfect. Your explanations are always accurate and simple to grasp. I appreciate all of the help you have given over the months. Your support is very helpful. Your commitment and teaching skills are outstanding. It was an excellent learning experience that I have so far greatly enjoyed. I appreciate your ongoing support from the beginning. Good luck in the future and keep up the fantastic work. I look forward to getting to know you and spending valuable time with you while learning from you. You are my inspiration and I admire you a lot. You are the best, Nishant Bhaiya!

  • @pooja2254
    @pooja2254 2 ปีที่แล้ว +1

    Thanku for the wonderful explanation

  • @sumitkanth5349
    @sumitkanth5349 2 ปีที่แล้ว +1

    Day 43 me - programming muje smj rhi h, thanks bhaiya :)

  • @vikasbagri1225
    @vikasbagri1225 2 ปีที่แล้ว +6

    I literally got goosebumps when I see this approach. Hats off to those who come up with these ingenious ideas
    And one suggestion is if possible try this problem
    MAXIMUM OF ALL SUBARRAYS OF SIZE K
    as the intuition behind the optimized version of this problem is also amazing and I think we all will like it

    • @ayushyadav1894
      @ayushyadav1894 ปีที่แล้ว

      Yes it's greatful to learn you can enroll Nishant AlgoPrep DSA program for better understanding.

  • @manemanoj3068
    @manemanoj3068 2 ปีที่แล้ว +1

    Mast Bhai pora samaj aa gaya...❤️Hyderabad...

  • @apoorvadubey2993
    @apoorvadubey2993 2 ปีที่แล้ว +1

    Thank you for teaching us these approach to the type problems in such a simplified way.

    • @ayushyadav1894
      @ayushyadav1894 ปีที่แล้ว +1

      Yes it's greatful to learn in simple way, you can enroll Nishant AlgoPrep DSA program for better understanding.

  • @vishalshrivastav1710
    @vishalshrivastav1710 2 ปีที่แล้ว +1

    Thanks for the video bhaiya well explained......... :)

  • @yashikagarg4044
    @yashikagarg4044 2 ปีที่แล้ว +2

    Great explanation ❤️❤️

  • @aftab.04
    @aftab.04 2 ปีที่แล้ว

    Day 43 and week 7 😊 compelled ❣️

  • @alexchandan9376
    @alexchandan9376 ปีที่แล้ว +28

    GFG ka same solution chipka diya hai😂

    • @hanovarghese9411
      @hanovarghese9411 8 หลายเดือนก่อน

      Gfg kya hai??

    • @alexchandan9376
      @alexchandan9376 8 หลายเดือนก่อน +1

      @@hanovarghese9411 It's a website for learning a lot of skills. Like programming languages, Databases, Cyber security and a lot of things.

    • @NeelakshiSachdeva
      @NeelakshiSachdeva 5 หลายเดือนก่อน

      ​@@hanovarghese9411 Geeks for geeks

    • @zk6ss
      @zk6ss 5 หลายเดือนก่อน +1

      Geeks for Geeks

  • @rajugouda8453
    @rajugouda8453 2 ปีที่แล้ว +1

    THANKS SIR 😍

  • @prakharchakravarty9471
    @prakharchakravarty9471 2 ปีที่แล้ว +2

    Doubt:--Why are we returning index..shoudn't we return (arr[i]-2n)??

    • @codingforme
      @codingforme ปีที่แล้ว

      this should be the case..coz they want the elements...but you get an error if u put (arr[i]-2n)...strangely it runs if u put i...sometimes u modify ur correct ans to a wrong ans to fit a wrong question :)

  • @srashtifarkya4940
    @srashtifarkya4940 2 ปีที่แล้ว +1

    Great Great Great Bhaiya 🔥🔥💓💓

  • @akashade7996
    @akashade7996 ปีที่แล้ว

    Nice to explanation is clear doubt from this video thank you for making this video and this type of video is need to the audience so thank you 🎉❤❤

  • @shubhamkumarsingh8818
    @shubhamkumarsingh8818 ปีที่แล้ว

    what an explanation man, thank you so much

  • @71_debduttaburman99
    @71_debduttaburman99 2 ปีที่แล้ว

    Thanks 🙏🏻

  • @mdrashid3367
    @mdrashid3367 2 ปีที่แล้ว

    Thank you very much bhaiya 💗

  • @preetkatiyar969
    @preetkatiyar969 2 ปีที่แล้ว

    Awesooooome explanation ❤️❤️❤️❤️

  • @WaniTech
    @WaniTech ปีที่แล้ว +1

    This method is working but this method is not ideal according to c++ standards, lets say we have array size of 5 and in that array there is an element 13, so if i calculate the index i.e index = arr[i]; // a[i] is 13
    a[index] = arr[i]%n; // a[13] = 13%5;
    we are accessing 13th element which is out of the range of array and it is working because of the undefined behaviour of C++, it will work for small numbers, if i try to access a large number lets say arr[4000] = 80; it will give me the segmentation fault...
    This can cause a major bug in a software.
    by the way you are doing great :-)

    • @dipesh3395
      @dipesh3395 ปีที่แล้ว

      I got the same doubt..
      Ig the method only works if the maximum element of the array

    • @nikhilkurrey9007
      @nikhilkurrey9007 ปีที่แล้ว

      @@dipesh3395 because the restriction of question is the elemets range is [1,n-1 ] then only it works

  • @user-ritesh92
    @user-ritesh92 10 หลายเดือนก่อน +1

    damn knowledge 💥

  • @yashdeepsingh785
    @yashdeepsingh785 2 ปีที่แล้ว

    Day 43 Completed and We will keeo going. Hopes to meet you soon bhaiya ❤️

  • @vaibhavigvp
    @vaibhavigvp 2 ปีที่แล้ว

    Thank you bhaiya for the day❤💪

  • @Pika-pw4jc
    @Pika-pw4jc ปีที่แล้ว +4

    why are we pushing i in ans vector instead of arr[i]?

    • @snehagupta6737
      @snehagupta6737 2 หลายเดือนก่อน

      did u get ans for ur ques?

  • @saurabhmishra-nn5xs
    @saurabhmishra-nn5xs 2 ปีที่แล้ว

    Please sir make more than two problems per days sir

  • @preethig6601
    @preethig6601 2 ปีที่แล้ว

    Bro in Microsoft what role u are working like web developer or app and whether u work in websites or in what

  • @shivdixit2587
    @shivdixit2587 2 ปีที่แล้ว +3

    Week 7 is abt to start.
    Never felt like it had came such a long way and I could follow it up everyday this long. 😂
    Really consistency op😎😎😎
    Thanks bhaiya 😊
    Shiv

  • @justdoingodswork
    @justdoingodswork ปีที่แล้ว +1

    But what if all numbers is different like {4,6, 28, 4, 6} is it possible?

  • @AbhishekPandey-yl3bp
    @AbhishekPandey-yl3bp 2 ปีที่แล้ว +1

    I think even if the question says that array has only one duplicate elements,you still can't use hare and tortoise method because array contains 0.

  • @MdRaza-ef3jj
    @MdRaza-ef3jj 2 ปีที่แล้ว

    Question done💥💥💥

  • @tishagupta4540
    @tishagupta4540 2 ปีที่แล้ว +1

    Nishant Bhaiya giveaway ka result kab aayga...eagerly waiting for Microsoft tour 💙

  • @abhiop1064
    @abhiop1064 2 ปีที่แล้ว

    Hello vaiya thanks for this type of videos ❤️🤞

  • @deepak__1
    @deepak__1 2 ปีที่แล้ว

    thanks for today

  • @kaustavpurkayastha
    @kaustavpurkayastha 2 ปีที่แล้ว

    Good sirji 🔥

  • @nashimbiswakarma
    @nashimbiswakarma ปีที่แล้ว +1

    Lacks dry run.

  • @naveenjodu21
    @naveenjodu21 2 ปีที่แล้ว

    great content 👌

  • @theparthsingh
    @theparthsingh 2 ปีที่แล้ว +1

    Your consistency says everything, great work bhaiya❤️

  • @ankit_6378
    @ankit_6378 2 ปีที่แล้ว

    Learned another great algo, of topic which students usually ignores.
    Thanks a lot #CodeIn10

  • @emtiazahmed5333
    @emtiazahmed5333 2 ปีที่แล้ว

    2nd comment now i am with u..i makeup all the previous lecture..

  • @AmanSingh-mw3iw
    @AmanSingh-mw3iw 7 หลายเดือนก่อน

    Why are you doing redundant %n if all elements are already 0

    • @amritatiwary.
      @amritatiwary. 6 หลายเดือนก่อน

      I recommend you , Dry run krke dekho , Then you will realise

  • @yashaggarwal6013
    @yashaggarwal6013 11 หลายเดือนก่อน

    but what if range is from 0 to N and not N-1 like in the leetcode question number 442?

  • @mdtouseeb264
    @mdtouseeb264 2 ปีที่แล้ว

    Thanx bhai🔥😎

  • @sounak4067
    @sounak4067 2 ปีที่แล้ว

    Day 43 done 🙂

  • @shuvrodas5155
    @shuvrodas5155 2 ปีที่แล้ว

    💕🎉🎉50k soon

  • @nishthaarora1907
    @nishthaarora1907 ปีที่แล้ว

    public int findDuplicate(int[] nums) {
    int n = nums.length;
    int[] ans = new int[n];
    for(int ele:nums)
    {
    ans[ele]+=n;
    if(ans[ele]/n>=2)
    {
    return ele;
    }
    }
    return -1;
    }
    why we are looping over the array twice ? isn't mentioned above is the precise soln?

  • @iam_niraj
    @iam_niraj 2 ปีที่แล้ว +1

    Consistency is the key to success. Thanks bhaiya for such lovely content.

  • @lethalleet
    @lethalleet 2 ปีที่แล้ว

    Day 43 done

  • @titusain1799
    @titusain1799 ปีที่แล้ว

    bhaiya solution contains error for4 1 case
    Input: nums = [4,3,2,7,8,2,3,1]
    Output: [2,3,4]
    output should be 2,3 only

    • @bhushandighe6586
      @bhushandighe6586 หลายเดือนก่อน +1

      Que alag hai bhai range dekho 1 To n hai tumhare que mai

  • @CodeandColors22
    @CodeandColors22 2 ปีที่แล้ว

    Done

  • @goelji_ki_beti
    @goelji_ki_beti 2 ปีที่แล้ว

    Issue in Algo for Below INPUT , Please check below, as the expected is also wrong as 4 is not repeated and it is still giving 4 as in answer,
    4 3 2 7 8 2 3 1
    Your Output:
    2 3 4
    Expected Output:
    2 3 4

    • @pradeepanand5296
      @pradeepanand5296 2 ปีที่แล้ว

      I think the expected value is 2 3 and output is 2 3 8 according to this algo. Question says array of size n containing upto n-1 elements. Ur array is size 8, it should contain only upto 7 cuz 8%8=0 which is giving index 0 as well also the 4%8=4 that is adding 8 to arr[4] gives 16 that's twice the value so that's why all the value in array should be lesser than array size.

    • @suyashsaraswar348
      @suyashsaraswar348 2 ปีที่แล้ว

      Expected output :
      2,3

  • @positiveattitude9506
    @positiveattitude9506 2 ปีที่แล้ว

    present here day 43 completed successfully best consistency bhaiya thank you Nishant bhaiya for your support ❤️ 50k soon #nishantchahar❤

  • @rajgopalmutnali1127
    @rajgopalmutnali1127 10 หลายเดือนก่อน

    but what if array has element that is greater than size of array?

  • @NeelsArts
    @NeelsArts ปีที่แล้ว

    Look at 4:42 suppose we have an array element 10 then 10%n(10%5) is 5......how do you get that 5th index in the areay

    • @deepanshu_the_vlogger
      @deepanshu_the_vlogger 9 หลายเดือนก่อน

      In Question it is given that if array size in 5 then element should be in range from (1-5).

  • @sakshiawadhiya7267
    @sakshiawadhiya7267 2 ปีที่แล้ว

    Jo questions most repeated ho companies me arrays ke wo bhi karwa digieye

  • @harshk8609
    @harshk8609 2 ปีที่แล้ว

    Bro thoda speed mein krao jisse beneficial ho.

  • @abhayrajkashyap2283
    @abhayrajkashyap2283 2 ปีที่แล้ว

    Nyc 😍☺️

  • @harikeshyadav4814
    @harikeshyadav4814 2 ปีที่แล้ว

    Day 43 🔥✅

  • @vedanthirlekar2660
    @vedanthirlekar2660 4 หลายเดือนก่อน

    but what if there is one large number in array like 1000

  • @deepakgaur8954
    @deepakgaur8954 2 ปีที่แล้ว

    Sir we are in 11 class please tell us about which stream is best for coding journey

  • @avishkumar6281
    @avishkumar6281 2 ปีที่แล้ว

    ❤❤

  • @vaidehideoghare4536
    @vaidehideoghare4536 ปีที่แล้ว

    My teat case did not pass its showing error of segmentation fault

  • @karanjot_singh
    @karanjot_singh 2 ปีที่แล้ว +6

    Today Notes
    Problem: Find Duplicates in an array
    Approaches:-
    1. Traverse the array and count each element.
    2. Store frequency of all elements in a different array.
    3. add %n for each index.
    vector is a dynamic array in c++, so it automatically updates its size to accommodate its elements pusback is used to add element to the back of a vector

  • @onthego22
    @onthego22 ปีที่แล้ว +3

    poor approach. It can be done in 1 loop as well.

  • @Abhishek-4uall
    @Abhishek-4uall 2 ปีที่แล้ว

    Love Babbar bhaiya ke 450 questions bhi kara dena please 😄😄

  • @minerbitcoin32
    @minerbitcoin32 2 ปีที่แล้ว

    Hi brother
    Can you please explain the Amazon AWS deeprace event for student i am interested in it
    Please make video on it on how to code the model
    Please 🥺

  • @akshatsingh433
    @akshatsingh433 2 ปีที่แล้ว

    👍

  • @pradeepanand5296
    @pradeepanand5296 2 ปีที่แล้ว +1

    I don't think modulo is even needed if all the value is between 1 to n-1. It would be needed if values are random but then this algo not work.

    • @reroyallover9169
      @reroyallover9169 ปีที่แล้ว

      same bro

    • @allenbenny5981
      @allenbenny5981 ปีที่แล้ว +1

      modulo is needed as we may visit the same index in future and if its value is greater than n it will give error

    • @AbhishekKumar-ys8eq
      @AbhishekKumar-ys8eq ปีที่แล้ว

      Same doubt here

  • @harshmishra3791
    @harshmishra3791 8 หลายเดือนก่อน

    This solution will not work for non repeting array

  • @sahiltakwale1937
    @sahiltakwale1937 ปีที่แล้ว

    Agar index variable use hi nhi ho raha, toh declare hi kyu kiya?

  • @AryanAgrawal94
    @AryanAgrawal94 หลายเดือนก่อน

    This solution is wrong, do anyone know any other solution for this problem?

  • @theharyanviskushaq
    @theharyanviskushaq 6 หลายเดือนก่อน

    In dry run you are creating a new array for updating the values.
    But in code you are updating the index of same array.
    If you update the original array then you will loss the original values.
    And arr[0]%n => 2%5 = 2 not 5 but in explanation you are adding 5 LOL.

    • @swarakubade2147
      @swarakubade2147 5 หลายเดือนก่อน

      Because we get the duplicate number by the index , so it doesnt matter if we lose the original values and we find the 2%5 to find the index at which we need to modify, so that and adding 5 are two different things

  • @palashh9
    @palashh9 2 ปีที่แล้ว

    Second today 🔥

  • @ezaanhussain-kt2ty
    @ezaanhussain-kt2ty ปีที่แล้ว

    Yours approach to find duplicate is not applicable to solve leetcode problem *find duplicate elements*

  • @nitishsharma2194
    @nitishsharma2194 ปีที่แล้ว

    Si biggner ke samne vector aya hi nahi hoga to vo kya samjhe bas copy to karna nahi hai chijo ko samjhna hsi na

  • @Thuglife_12
    @Thuglife_12 2 ปีที่แล้ว

    I need help

  • @Thuglife_12
    @Thuglife_12 2 ปีที่แล้ว

    You can help me

  • @Asur-hq2bn
    @Asur-hq2bn หลายเดือนก่อน

    wtf is background music??? what's the point of it

  • @ajaybirare1845
    @ajaybirare1845 ปีที่แล้ว

    Bhaiya explaination ke time pe jo music he bad me band kardo plz

  • @GauravYadav-bj7gn
    @GauravYadav-bj7gn 2 ปีที่แล้ว

    First here💯

  • @Thuglife_12
    @Thuglife_12 2 ปีที่แล้ว

    Please really i need help

  • @Thuglife_12
    @Thuglife_12 2 ปีที่แล้ว

    I bro i need help please help me

  • @Thuglife_12
    @Thuglife_12 2 ปีที่แล้ว

    Please help me please

  • @Thuglife_12
    @Thuglife_12 2 ปีที่แล้ว

    Please help me please 😭

  • @Sunnykhatnani
    @Sunnykhatnani ปีที่แล้ว

    akhiri me galat bola hai

  • @nayanjha5670
    @nayanjha5670 ปีที่แล้ว

    ye ad me aditya kachve ko dekh ke gussa aajata hai

  • @bhushantadele5586
    @bhushantadele5586 9 หลายเดือนก่อน

    Apko kitna time laga tha pehli bar jab solve kiya tha tb.. Air ye apko khud ka logic hai kya?

  • @vignesh5618
    @vignesh5618 2 ปีที่แล้ว

    would be helpful if you speak in english

  • @nitishsharma2194
    @nitishsharma2194 ปีที่แล้ว

    Jab array bata rahe hai ho to push pop pe Jane ki kya jarurat hai bhai sabh bigner thodi na samjhega jaldi dimple language explain karne ka na

  • @navin55532
    @navin55532 ปีที่แล้ว

    galat explain kiya hai bhai.. pata ni kaha se 80+K subs hai tere

  • @lalitgaikwad7238
    @lalitgaikwad7238 ปีที่แล้ว

    you doesn't taught very well by dry running more Test Cases, your explanations are not that much clear enough. your Handwriting is also poor. LoveBabbar and Raj Vikramaditya are more Better than you in every aspect.

  • @anuragsaini3296
    @anuragsaini3296 3 หลายเดือนก่อน

    Plzz aap padhana chod do
    For the sake of the universe

    • @Curious.chahar
      @Curious.chahar  3 หลายเดือนก่อน

      Chod diya bhai 2 saal pehle hi 😂

    • @anuragsaini3296
      @anuragsaini3296 3 หลายเดือนก่อน +1

      @@Curious.chahar Just joking. My attention is not to hurt you
      Just kidding 😃

  • @HimanshuGoswami-qt6tm
    @HimanshuGoswami-qt6tm 8 หลายเดือนก่อน

    worst explaination

  • @ArtePixels3D
    @ArtePixels3D ปีที่แล้ว

    You won one more member, I'm very grateful. Can you share your e-mail?

  • @ShitanjaliKasera
    @ShitanjaliKasera 2 ปีที่แล้ว

    Day 43 and week 7 😊 compelled ❣️

  • @Thuglife_12
    @Thuglife_12 2 ปีที่แล้ว

    Please help me please

  • @Thuglife_12
    @Thuglife_12 2 ปีที่แล้ว

    Please help me