Find the Missing and Repeating Number | 4 Approaches 🔥

Поділитися
Вставка
  • Опубліковано 11 жов 2024

КОМЕНТАРІ • 239

  • @takeUforward
    @takeUforward  Рік тому +109

    Note: Please don't use the given array to solve the problem, modifying the input is highly discouraged in an interview.
    Why? Imagine I give you user data, and ask you to do a task for me using that data, will you modify that data in order to do it? No right, unless I ask you to do so, then only you should.

    • @mdrazahassan6315
      @mdrazahassan6315 Рік тому +3

      Can anyone please explain time complexity for XOR approach . How come it is O(n) when we are running loop for 4 time?

    • @shreyaspakhare1313
      @shreyaspakhare1313 Рік тому

      @@mdrazahassan6315 Big O notation is defined as the upper bound on the run time of the algorithm. If the run time of the algorithm is denoted by f(n), the algorithm is O(g(n)) if c1.g(n)>= f(n) for all n >= n1.
      So in this case we can take g(n) = n and c1 = 5 and obtain the required result.

    • @harikrishnas1299
      @harikrishnas1299 Рік тому

      @@mdrazahassan6315 Got your answer bro ? If yes do explain here !

    • @hayyith4903
      @hayyith4903 4 місяці тому +1

      I solved in O(N)+O(N log(N)) Time and O(1) space Complexity
      import java.util.*;
      public class Find_repeating_missing_numbers {
      public static void main(String[] arggs){
      int[] arr ={4,3,6,2,1,1};
      Arrays.sort(arr);
      int repeat = 0;
      int missing = 0;
      int n = arr.length;
      for(int i=0;i

    • @shrutiverma-ge6we
      @shrutiverma-ge6we 4 місяці тому

      Hey, I was solving this question on GFG question directed by the link given in Striver's 79 last moment question. But using this solution, only 200/340 TCs passed. Can you please look into it? It will also help other student. Please reply and thankyou so much for creating such excellent content. You really make it easier to learn.

  • @anshumaan1024
    @anshumaan1024 Рік тому +99

    Same question @leetcode : *Set Mismatch* 🙂🙂

    • @kipa_chu
      @kipa_chu 26 днів тому

      No its different. The input limit is not 1 to N

    • @iamxpossible
      @iamxpossible 20 днів тому

      @@kipa_chu it is

    • @iamxpossible
      @iamxpossible 20 днів тому

      @@kipa_chu You have a set of integers s, which originally contains all the numbers from 1 to n. Unfortunately, due to some error, one of the numbers in s got duplicated to another number in the set, which results in repetition of one number and loss of another number.

  • @NoBakwas
    @NoBakwas Рік тому +137

    To those whose testcases are failing on gfg and coding ninjas, you need to make sure the 'n' being used in formula is actually in long long format. The 'n' given to us is in 'int' format, so just create a variable 'long long N=n' and then use this 'N' in place of wherever 'n' was used.

    • @msd6674
      @msd6674 Рік тому +3

      THANKS i submitted 3 time by changing different thing but 1 test case failed everytime....thanku so much for saving my time

    • @vanshikagupta6738
      @vanshikagupta6738 Рік тому +1

      thanks a lot😄

    • @raunakkumar6144
      @raunakkumar6144 Рік тому +2

      Can you share your code i have tried everything and it still fails.

    • @lakeshkumar1252
      @lakeshkumar1252 Рік тому

      thanks

    • @OKarthikAlle
      @OKarthikAlle Рік тому

      Tqsm

  • @deepakagrawal7687
    @deepakagrawal7687 Рік тому +23

    I am hear to teach you problem solving. Thats a great saying bother. It actually motivates a lot to look from the point of view of being a great engineer and solving complex problems rather than preparing from interview perspective. Good one

  • @Mangesh_65
    @Mangesh_65 2 місяці тому +6

    Bro , usually I don't do comments in any videos ..but this video's forces me to do...top notch content , understood all the 4 algorithm!!❤🎉

  • @thenikhildaiya.
    @thenikhildaiya. Рік тому +18

    This problem is available on leetcode with name "Set Mismatch". Thoda story based question hai but exactly same hai😊

  • @crazyxyzk143
    @crazyxyzk143 Рік тому +15

    Hy sir as you already know that our summer holidays are started, so I request you to please increase the frequency of upload 🙏🙏

  • @pulkitgupta669
    @pulkitgupta669 Рік тому +11

    Hey I found one more optimal approach in O(n). This also uses some maths
    int n = a.size();
    int sum = 0;
    int p;
    for(int i=0; i

    • @vrajpatel9259
      @vrajpatel9259 4 місяці тому

      what is abs here ? vector abs; ??

    • @pulkitgupta669
      @pulkitgupta669 4 місяці тому

      @@vrajpatel9259 it's absolute value fn returns always the positive number as output

    • @UnKnown-lp9gl
      @UnKnown-lp9gl 4 місяці тому

      I thought the same idea but as per the question we should not modify 'a' since it's tuple...if we have to then we have convert it to a list...which is taking extra space isn't it...

  • @mano_003
    @mano_003 Рік тому +8

    Hey striver lots of love and support for u ❤❤ u r doing such a great great work for us thanks a lottttt.......it means a lot

  • @culeforever5408
    @culeforever5408 11 місяців тому +3

    understood, will come back later to understand the last approach :)

  • @captureitall5936
    @captureitall5936 Рік тому +6

    I saw differnt youtubers doing a negation method by mofying the given array which is so wrong just loved this explanation by striver bhaiya 🔥🔥❤❤

  • @samarthpai5359
    @samarthpai5359 9 днів тому +1

    those who are getting floating point error, just make sure val1 is not 0. if it is 0 then return {0, 0}

  • @pushankarmakar1783
    @pushankarmakar1783 8 місяців тому +2

    BRUTE FORCE:
    num=[0]*(len(a)+1)
    for i in range(len(a)):
    num[a[i]]+=1
    for i in range(len(num)):
    if i==0:
    continue
    elif num[i] > 1:
    P=i
    elif num[i]==0:
    Q=i
    return [P,Q]

  • @kaichang8186
    @kaichang8186 22 дні тому

    thanks for the mind blowing final optimal approach

  • @nostalgiccringeallhailchel3881

    Time complexity :- O(nlogn) with the xor method.
    space complexity :- O(1)
    Used the property
    a ^ b = c
    a = c ^ b
    logn is for finding the repeating number by having a counter to traverse through the array.
    class Solution{
    public:
    vector findTwoElement(vector arr, int n) {
    int x = 0, y = 0;
    for(int i = 1; i

    • @sarthakkk8628
      @sarthakkk8628 11 місяців тому +1

      you could have avoided that extra for loop, and used the first one only for the calculation of repeating

  • @gorantlakarthik6875
    @gorantlakarthik6875 9 місяців тому +2

    There would be one more optimal approach.. since the values all could lie between 1 to N including both, and indexes are from 0 to N-1. You can find arr[i] and swap it with arr[arr[i]-1] (since index would be 1 less the value in it), and increment the ptr... thus in any case if you find that arr[i] and arr[arr[i]-1] are equal. then arr[i] is the duplicate element, and then finding duplicate element is easy using both sums(S, Sn). The mentioned two methods were good and cool as well.

  • @devchangela8379
    @devchangela8379 Рік тому +3

    Absolutely amazing sir!! thank you very much!! Just to know, when will you start teaching linked list, stacks, queue ??

  • @habeeblaimusa4466
    @habeeblaimusa4466 Рік тому +13

    Bro, I noticed that majority of the array question in the medium and hard part optimization involves hashing. Like 70%..

    • @shaurya2608
      @shaurya2608 Рік тому +6

      Yes because hashing helps to calculate the number of occurences

  • @priyadarsinipaikaray4998
    @priyadarsinipaikaray4998 Рік тому +7

    Master blaster ❤ your explanation is very clear and we understand it very well ❤ thank you for such efforts 🙏

  • @anuplohar23
    @anuplohar23 9 місяців тому

    Because of YOU I understood the XOR method very easily
    Thanks Striver Bhaiyya

  • @sukhpreetsingh5200
    @sukhpreetsingh5200 Рік тому +8

    Thanks a lot for this amazing content. I would like to share one more approach using modulo operator by placing each number at its correct position==>
    #include
    pair missingAndRepeating(vector &arr, int n)
    {

    int i=0;
    while(i

    • @abdulrehmanamer4252
      @abdulrehmanamer4252 4 місяці тому

      class Solution:
      def findTwoElement( self,arr, n):
      # code here
      repeat = None
      i = 0
      while i < n:
      if i is arr[i] - 1 or arr[i] is True:
      arr[i] = True
      i += 1
      elif arr[arr[i] - 1] is True:
      repeat = arr[i]
      i += 1
      else:
      temp = arr[arr[i] - 1]
      arr[arr[i] - 1] = True
      arr[i] = temp

      for i in range(1, n + 1):
      if arr[i - 1] is not True: return repeat, i
      I have done almost the same thing but gettling TLE at 103th test case. The constraint is 10^5 so n should be run faster. but here why am I getting TLE?

    • @abdulrehmanamer4252
      @abdulrehmanamer4252 4 місяці тому

      My submission has been accepted I just changed the 'is' to '==' and voila! cause is takes a lot time than '==' cuase of its type checking etc

  • @shubhamagarwal1434
    @shubhamagarwal1434 2 місяці тому +1

    #Free Education For All.. # Bhishma Pitamah of DSA...You could have earned in lacs by putting it as paid couses on udamey or any other elaerning portals, but you decided to make it free...it requires a greate sacrifice and a feeling of giving back to community, there might be very few peope in world who does this...."विद्या का दान ही सर्वोत्तम दान होता है" Hats Off to you man, Salute from 10+ yrs exp guy from BLR, India.

  • @parshurammahindrakar6973
    @parshurammahindrakar6973 6 місяців тому

    I tried one more optimal approach where we don't need to Use Square sum.
    vector findMissingRepeatingNumbers(vector < int > a) {
    sort(a.begin(),a.end());
    int dup=-1;
    int sum=0;
    for(int i=0;i=1 && a[i]==a[i-1])
    {
    dup=a[i];
    }
    }
    int n=a.size();

    int sum2=n * (n+1);
    sum2=sum2/2;
    int ans=sum2-(sum-dup);
    return{dup,ans};
    }

    • @adityasanthosh702
      @adityasanthosh702 6 місяців тому

      Sorting takes O(nlogn). So your solution even though it doesn't do square sum is inferior

  • @divy04
    @divy04 3 місяці тому

    2nd approach was amazing man, brilliant

  • @dhrumilparmar1505
    @dhrumilparmar1505 8 місяців тому +1

    Tip : Xor of Natural Numbers can be calculate in O(1)
    code:
    lets say you want to do xor of number from 0->n.
    then
    ...........................................
    if (n % 4 == 0)
    {
    xor2 = n;
    }
    else if (n % 4 == 1)
    {
    xor2 = 1;
    }
    else if (n % 4 == 2)
    {
    xor2 = n + 1;
    }
    else if(n % 4 == 3)
    {
    xor2 = 0;
    }
    ............................................................
    xor2 is ans!!!!
    reason: xor of natural number are periodic in nature and depends on last number n;
    do upvote if you find this helpfull

  • @TaoqeerNezam
    @TaoqeerNezam 5 місяців тому +1

    16:54 bro encountered the greatest problem in entire computer science

  • @srinivasbeta8202
    @srinivasbeta8202 Рік тому

    the last approach is mind blowing

  • @Manishgupta200
    @Manishgupta200 Рік тому +1

    THe XOR method it tough to understand but the method is really helpful to understand the bit concept. And a very optimal approach.

  • @FastTech1000
    @FastTech1000 8 місяців тому

    one more approach make them at correct position
    vector findMissingRepeatingNumbers(vector a)
    {
    int n = a.size();
    long long sum = 0;
    int repeat, missing;
    for (int i = 0; i < a.size(); i++)
    {
    sum += a[i];
    }
    int i = 0;
    while (true)
    {
    while(a[i]==i+1) i++;
    int idx = a[i];
    if (a[idx - 1] == a[i])
    {
    repeat = a[idx - 1];
    break;
    }
    swap(a[idx - 1], a[i]);
    }
    missing = (n * 1ll * (n + 1)) / 2 - (sum) + repeat;
    return {repeat, missing};
    }

  • @shohamkar7004
    @shohamkar7004 Рік тому +2

    Below here is another method using Cyclic Sort that takes O(2N) time and O(1) space complexity.
    class Solution {
    public:
    vector findTwoElement(vector arr, int n) {
    vector ans(2);
    for(int i=0; i

    • @khushaliporwal2582
      @khushaliporwal2582 3 місяці тому

      Why are you swapping? What's the intuition behind this?

  • @AnjuGupta-sz1uk
    @AnjuGupta-sz1uk 8 місяців тому

    Awesome explanation...Understood all the approaches

  • @manishkumarsah6898
    @manishkumarsah6898 3 місяці тому

    00:04 Find the repeating and missing number in an array of integers.
    02:03 Implementing Brute Force approach for finding missing and repeating numbers
    06:23 Optimal solution for finding the missing and repeating number using basic mathematics
    08:23 The missing number is 5 and the repeating number is 1.
    13:01 Finding the Missing and Repeating Number using equations
    15:23 The main equation to find the missing and repeating number is x - y = value 1 and x + y = value 2
    19:51 Using the XOR concept to find the missing and repeating numbers.
    21:43 The differentiating bit between two different numbers can be found by comparing their binary representations.
    25:45 Numbers appearing even number of times are part of the zero club and odd number of times are part of the one club
    27:48 The missing number is 5 and the repeating number is 1.
    31:29 Find the missing and repeating number using four approaches
    33:23 Finding the missing and repeating number using 4 approaches
    37:16 The process involves canceling out the numbers using bit manipulation.
    39:16 Bit manipulation trick to find a missing number can be written as x and not of x minus one

  • @abhishekkumartiwari913
    @abhishekkumartiwari913 Рік тому +1

    Hii bhaiya! Great solution.
    why can't we use hare-tortoise to find the repeating number and then maths to find the missing number.

  • @jayanthvanamamala1425
    @jayanthvanamamala1425 Рік тому +2

    Thank you striver for giving us such a wonderful course , but there can be another approach we can do it by using floyds cycle detection technique also .

    • @himanshukaushik9223
      @himanshukaushik9223 Рік тому +1

      Bro third approach sa TLE arha hai gfg pa??

    • @lostcyrus8578
      @lostcyrus8578 Рік тому

      @@himanshukaushik9223 yes mera ara h

    • @boredguy6973
      @boredguy6973 Рік тому

      I tried doing it by the Floyd's cycle detection method, I got a runtime error. For example in this test case, n = 6; arr = {6,5,4,3,4,1}. Slow pointer will by pointing towards i=6 and i is limited to 5. Correct me if I am wrong here.

  • @kishorkumarbehera5412
    @kishorkumarbehera5412 Рік тому

    Whose test case is failing in case of mathematical solution, its because while calculating S2N, the values might get overflowed. So you need to typecast like you were doing while summing up S2. Or you need to define 'n' as long long.

  • @alessandrocamilleri1239
    @alessandrocamilleri1239 Рік тому +2

    Thank you for the great explanation. If you adopt the third approach and forget the formulas for the summation of the n natural numbers and their squares, would it be frowned upon if you summate inside the loop together with the summation of the given input?

  • @NISHANTRAJ-rl9lf
    @NISHANTRAJ-rl9lf 28 днів тому

    Blowned Up!!!!

  • @killerx21
    @killerx21 2 місяці тому

    Understood Thanks Sir!

  • @samarthpai5359
    @samarthpai5359 9 днів тому +1

    understood!

  • @vishal-sr5et
    @vishal-sr5et Рік тому

    Last approach was really intersting ..

  • @sehajbirsingh5381
    @sehajbirsingh5381 7 місяців тому

    Great explanation! 🙂

  • @devmadaan5146
    @devmadaan5146 Рік тому +4

    bro do you have set a deadline to complete the vid solution of DSA course!! If only one vid will be upploaded in a day then also it would take an year to finish DSA course!!! Can u winish the DSA couse till june please please please

    • @takeUforward
      @takeUforward  Рік тому +15

      Bro, majority of videos are out of advanced topics. You can move ahead and do them.
      I will not be compromising on quality, even if it takes me sometime.
      Also, how do you expect someone to upload more than 1 video. A day just has 24 hours FYI.

  • @pratyushtripathi1728
    @pratyushtripathi1728 10 місяців тому +1

    Understood 😊

  • @chiragdusad2015
    @chiragdusad2015 6 місяців тому +1

    Brother my one question to you is that now after the Devin came into the picture, is there the software development will come to the end for the freshers as by the trends and the rise of ai recently makes me think that even after doing ton of dsa don't make our future safe so can we shift to data or cloud, what is your take on it?

  • @ItsAbhiDestiny
    @ItsAbhiDestiny 3 місяці тому +1

    class Solve {
    int[] findTwoElement(int arr[], int N) {
    // Calculate expected sum and sum of squares
    long n = N;
    long SN = (n * (n + 1)) / 2;
    long S2N = (n * (n + 1) * (2 * n + 1)) / 6;
    // Calculate actual sum and sum of squares
    long S = 0, S2 = 0;
    for (int i = 0; i < n; i++) {
    S += arr[i];
    S2 += (long) arr[i] * (long) arr[i];
    }
    // Calculate val1 and val2
    long val1 = S - SN;
    long val2 = S2 - S2N;
    // Calculate X + Y
    long sumX_Y = val2 / val1;
    // Calculate X and Y
    long X = (val1 + sumX_Y) / 2;
    long Y = X - val1;
    return new int[]{(int)X, (int)Y};
    }
    }

  • @VasanthChoudary-uc5cz
    @VasanthChoudary-uc5cz 11 місяців тому

    bro we can also use cyclic sort so that repeating element goes and occupies the place of missing element, perform another iteration to check which element is not at correct place.

  • @Prabhatsinghrajput-qj3jo
    @Prabhatsinghrajput-qj3jo Місяць тому +1

    my solution for this
    public static List Find(int []arr, int n){
    Listlist = new ArrayList();
    if(arr[arr.length-1] != arr.length){
    list.add(n);
    }
    Arrays.sort(arr);
    for (int i = 0; i

  • @radhee6049
    @radhee6049 Рік тому

    superb explanation last one

  • @AkshayKumar-m5l6t
    @AkshayKumar-m5l6t 3 місяці тому

    I know Im Quite late guys, but to understand WHY he needed the BitNumber
    The bit number is used to split X and Y into two different groups (One and Zero)
    and if all the numbers in each of the groups are XOR'ed, our required numbers X and Y are left behind.
    it doesnt matter if X^Y have many different bits, any of them will work to solve our problem

  • @AdarshSoni-js6hh
    @AdarshSoni-js6hh Місяць тому

    Respected striver had six star profile on code forces then what made him fail to make us understand the algorithm and hard problems as well
    Amazing quality of teaching us the most amazing apprpach of doing XOR

  • @AbhishekGupta-xz1gd
    @AbhishekGupta-xz1gd Рік тому

    Wonderful explanation!

  • @AniketKumar-hf2bo
    @AniketKumar-hf2bo 7 місяців тому

    amazing video explanation ❤❤❤❤❤❤

  • @aman6041
    @aman6041 4 місяці тому

    thanks striver sir for this much explanation.

  • @joeljacob4685
    @joeljacob4685 Рік тому

    Awesome explantion 😍

  • @raunakkumar6144
    @raunakkumar6144 Рік тому +1

    sum of squares method is failing in GFG at some test case
    here's my code
    vector findTwoElement(vector arr, int n) {
    long long N=n;
    long long Sn= (N*(N+1))/2;
    long long S2n=(N*(N+1)*((2*N)+1))/6;
    long long sum=0;
    long long sum2=0;
    for(int i=0;i

  • @bhavyathakkar5913
    @bhavyathakkar5913 5 місяців тому

    Can we use a different approach run a loop from 0 to n-1(calculate sum) in each iterartion check if number exists in hash if exists store as repeating number if not add to hashmap
    after loops is done excecuting we will have repeating number and sum of arr we can calculate sum of n numbers
    to get the missing number we can just use formula ( (Es(expected Sum of n numbers) - As(array sum)) + repeating number)
    Time complexity: O(N)
    Space complexity: O(N)

  • @NazeerBashaShaik
    @NazeerBashaShaik 6 місяців тому

    Understood, thank you.

  • @shra1
    @shra1 Рік тому

    will visit it again for xor solution

  • @juhichoudhary9281
    @juhichoudhary9281 10 місяців тому

    Keep the second loop from n+2 it will pass your all 5 test case

  • @vinodpal4068
    @vinodpal4068 Рік тому

    you do not have to memorize the formula, instead you can calculate the sum in the form first for loop
    int naturalSum = 0;
    int arraySum = 0;
    int squarNaturalSum = 0;
    int squareArraySum = 0;
    for(int i=0;i

  • @dilipkumarbk7657
    @dilipkumarbk7657 5 місяців тому

    UNDERSTOOD 🎇✨

  • @harshilpatel3205
    @harshilpatel3205 9 місяців тому

    Understood 🔥

  • @WEB_D_lec
    @WEB_D_lec Рік тому

    I think the space complexity will be 0(max_element_of_array) if there is mistake please reply.

  • @SandeepKumar-ps9un
    @SandeepKumar-ps9un 11 місяців тому

    iterate and find the repeating number , then find the sum of N numbers and find the sum of the given vector
    then subtract the repeating number for the vector sum and name it Fresh , find the difference of N sum and the Fresh
    u will get the missing number and the answer and the repeating number.

  • @saswatrath4646
    @saswatrath4646 6 місяців тому

    took about 3 hours to finish and understood everything

  • @SitaRam-m1i
    @SitaRam-m1i 4 дні тому +1

    Understood

  • @sayandey2492
    @sayandey2492 10 місяців тому +1

    To me, XOR approach seemed to be easier to implement...crystal clear explanation 👏

  • @parth2439
    @parth2439 Рік тому

    Thank you!!

  • @venup2813
    @venup2813 Рік тому +1

    understood sir

  • @mehulthuletiya497
    @mehulthuletiya497 Рік тому +2

    I am not feeling well, so I timestamped it 1 day later.
    00:20 Problem Statement
    01:14 Brute Force approach
    02:08 Pseudocode
    03:18 Complexity
    03:47 Better approach (Hashing)
    05:41 Code
    06:58 Complexity
    07:28 Optimal approach (Maths + XOR)
    08:01 Solution-01 (Maths)
    08:08 Intuition + Approach
    14:54 Code
    19:17 Complexity
    19:55 Solution-02 (XOR)
    20:15 Intuition + Approach
    31:11 Code
    41:24 Complexity

  • @YourCodeVerse
    @YourCodeVerse 11 місяців тому

    Understood✅🔥🔥

  • @purvi9958
    @purvi9958 Рік тому

    Thankyou sir!

  • @pj-nz6nm
    @pj-nz6nm Рік тому +1

    hey striver do you have any plans to make videos on OOPs? there is no good playlist that teaches OOPs from beginner to advanced.

  • @Nishantkumar-oh9th
    @Nishantkumar-oh9th Рік тому +4

    Yr Kya bnda h yrr...mtlb...khopdi me concept aa jati h isse pdhke

  • @VishalPanwar-df5ek
    @VishalPanwar-df5ek Рік тому

    Can anypne plz tell why we started i from 1 from next iteration and also why i

  • @harikrushnasuhagiya3925
    @harikrushnasuhagiya3925 Рік тому

    Thanks a lot brother

  • @himanshukaushik9223
    @himanshukaushik9223 Рік тому +2

    3 approach ma gfg ka link hai usma repeat and missing return karna hai tho dynamically allocation karka karne ha kya reply kar do koi bhi ??

  • @muchmunchies43
    @muchmunchies43 2 місяці тому

    Understood!!

  • @ish8591
    @ish8591 11 місяців тому +1

    19:17 sir jab aapne x and y ki type casting long long se kri hai toh return krte vakt int int kyu laga diya?

    • @uday2159
      @uday2159 7 місяців тому +1

      We need to return int values.
      We can also type cast at assigning of x and y
      Like:
      int x=(int) ( (val1 + val2)/2) ;

  • @RituSingh-ne1mk
    @RituSingh-ne1mk 9 місяців тому

    Understood!

  • @oldguardkiller8408
    @oldguardkiller8408 Рік тому

    Loved your solution of xor but we can simply do it with cycle sort if numbers are in range of 1 to n..

    • @takeUforward
      @takeUforward  Рік тому +9

      you should never alter the input, unless the question specifically says you to do it

  • @RAHULROY-sb9nt
    @RAHULROY-sb9nt Рік тому

    pls do complete this series upto ultra advance level.

  • @shubhammeena2316
    @shubhammeena2316 Рік тому

    thank you sir

  • @hashtagcc
    @hashtagcc 7 місяців тому

    implementing using cyclic sort is also an effecient approach right?
    import java.util.Arrays;
    public class Solution {
    public static int[] findMissingRepeatingNumbers(int []nums) {
    // Write your code here
    for(int i=0;i

  • @Ekam873
    @Ekam873 3 місяці тому

    what if 5 is repeating and 6 is missing both will be in 1 bit segregate then it will be 5^6 in 1 bit part. Please explain

  • @AbhishekBhattacharjee-j2m
    @AbhishekBhattacharjee-j2m Рік тому

    UNDERSTOOD

  • @varunpalsingh3822
    @varunpalsingh3822 Рік тому

    understood 👍👍

  • @AnudeepUppu
    @AnudeepUppu Рік тому

    Loved it😍

  • @DeadPoolx1712
    @DeadPoolx1712 Місяць тому

    UNDERSTOOD;

  • @mayanksharma1491
    @mayanksharma1491 6 місяців тому

    Arithmetical sol not working for [3,3,3,3,3]..it gives -5 for duplicate element...answer should be 3

  • @gautamsaxena4647
    @gautamsaxena4647 7 днів тому

    understood bhaiya

  • @manimaran3926
    @manimaran3926 8 днів тому

    can we use cyclic sort to solve this

  • @sauravchandra10
    @sauravchandra10 Рік тому

    Is the 3rd approach getting submitted on GFG? Because mine's isn't.

  • @omgupta777
    @omgupta777 11 місяців тому

    Thankyou

  • @harishm6919
    @harishm6919 9 місяців тому +1

    super

  • @hemantpatel1413
    @hemantpatel1413 3 місяці тому

    understood.

  • @ankitjanghu3480
    @ankitjanghu3480 Рік тому

    Bhayia your java code isn't giving the proper solution it hasn't accepted by the gfg after some test cases can someone please help me in that. for the mathematical approach

  • @YadhukrishnanMM-z6k
    @YadhukrishnanMM-z6k 10 місяців тому

    can i use here floyds tortoise alogorithm to find repeating element

  • @MaheshPatil-of1zy
    @MaheshPatil-of1zy 6 місяців тому

    what is Gurantee that the val2/val1 always divide with remainder zero?

  • @randomguy7246
    @randomguy7246 Рік тому

    can anyone tell me upto when this DSA course will be fully completed as, I want to complete this in my holidays this year.