Rotate Array by K places | Union, Intersection of Sorted Arrays | Move Zeros to End | Arrays Part-2

Поделиться
HTML-код
  • Опубликовано: 10 июл 2024
  • Notes/C++/Java/Python codes in Step 3.1 of bit.ly/tufA2ZYt
    Left Rotate array by 1 place: takeuforward.org/data-structu...
    Left Rotate array by D places: takeuforward.org/arrays/left-...
    Right Rotate array by d places: takeuforward.org/arrays/right...
    Move zeros to End: takeuforward.org/data-structu...
    Linear Search: takeuforward.org/arrays/linea...
    Union of two sorted Arrays: takeuforward.org/data-structu...
    The intersection of two sorted arrays: takeuforward.org/data-structu...
    Problem links
    Left Rotate array by 1 place: bit.ly/3ZeXGrO
    Left Rotate array by K places: bit.ly/3IQQdrt
    Move zeros to End: bit.ly/3XbsF6k
    Linear Search: bit.ly/3GmcVGJ
    Union of two sorted Arrays: bit.ly/3IpS7Rd
    Intersection of two sorted arrays: bit.ly/3KSSx3Z
    We have solved the above problems, and we have gone from brute force and ended with the most optimal solution.
    Full Course: bit.ly/tufA2ZYt
    You can follow me across social media, all my handles are below:
    Linkedin/Instagram/Telegram: linktr.ee/takeUforward
    0:00 Introduction of course
    01:01 Left rotate an Array by 1 Place
    07:17 Code-compiler (Left rotate an Array by 1 Place)
    08:05 Left rotate an Array by D Places
    20:18 Code-compiler (Left rotate an Array by D Places )
    27:13 Move zeroes to end
    40:30 Code-compiler (Move zeroes to end )
    41:05 Linear search
    42:43 Code-compiler (Linear search )
    43:04 Union of two sorted array
    53:33 Code-compiler (Union of two sorted array)
    59:05 Intersection of two sorted array
    1:09:30 Code-compiler (Intersection of two sorted array)

Комментарии • 755

  • @takeUforward
    @takeUforward  Год назад +175

    Let's march ahead, and create an unmatchable DSA course! ❤
    Timestamps someone please :)
    Use the problem links in the description.

    • @brajeshmohanty2558
      @brajeshmohanty2558 Год назад +5

      At 23:47 my mind just got blown away. Me be like: - itna easy kese Benstocks 😂🙏. Bhai iPad ka notes ka bhi pdf dalo na . Tumaaher writing sei sab samajh mai ata hai. Boh tuf sight par itna bada article dekhne sei dar lagta hai 🙂. But you are doing amazing job bhai thank you 🙏😌.

    • @Atharva_kathiyawadi
      @Atharva_kathiyawadi Год назад

      appreciable !!

    • @ParasSharma-mf8or
      @ParasSharma-mf8or Год назад

      Please upload the next video.

    • @gautamsethiya1397
      @gautamsethiya1397 11 месяцев назад

      @takeUforward
      class Solution {
      public:
      void rotate(vector& nums, int k) {
      int n = nums.size();

      k =k%n;
      int temp[k];
      for (int i = n - k; i < n; i++)
      {
      temp[i - n + k] = nums[i];
      }
      for(int i=n-k-1;i>=0;i--)
      {
      nums[i+k]=nums[i];
      }
      for(int i=0;i

    • @yaswanthmitta8983
      @yaswanthmitta8983 11 месяцев назад

      for moving zeroes to the end we cen write it in 1 loop instead of two though time complexity is same , complexity for understanding decreases : v oid moveZeroes(vector& nums) {
      int j=0;
      for(int i=0;i

  • @AniketKumar-tc8cz
    @AniketKumar-tc8cz Год назад +120

    Timestamps:
    0:00:00 - Intro
    0:00:55 - Q1. Left rotate an array by 1 place
    0:07:33 - Q2. Left rotate an array by D places
    0:26:36 - Follow up Right rotate an array by D places
    0:27:11 - Q3. Moving Zeroes to end
    0:40:54 - Q4. Linear Search
    0:43:01 - Q5. Union of Two Sorted Arrays
    0:59:04 - Q6. Intersection of Two Sorted Arrays
    1:12:22 - Outro

  • @bishalkundu7592
    @bishalkundu7592 Год назад +104

    Thanks a lot sir for taking out time from your busy schedule and making videos and uploading those videos in the span of 2-3 days. It takes a lot ot effort. Thanks a lot 😊😊

  • @AdityaKumar-gx2ip
    @AdityaKumar-gx2ip Год назад +27

    For Right Rotation of Array
    void rotate(vector arr, int d)
    {
    if(d>size)
    d = d % size;
    reverse(arr.begin(),arr.end());
    reverse(arr.begin()+d,arr.end());
    reverse(arr.begin(),arr.begin()+d);
    }

  • @luckshaeey
    @luckshaeey Год назад +66

    27:00 rotating an array left by 1 place is equal to rotating it right by n-1 places. We can use this information for rotating an array to right by d places.

    • @takeUforward
      @takeUforward  Год назад +39

      Perfect thought!

    • @bhargavanand7325
      @bhargavanand7325 Год назад

      great

    • @himanshukaushik9223
      @himanshukaushik9223 Год назад +2

      Bhai leetcode pa left rotation question reverse .end() and begin() use karna pad Raha hai but gfg ma nahi why

    • @bhargavanand7325
      @bhargavanand7325 Год назад +3

      @@himanshukaushik9223 in case of vector we use stl function like begin() and end() but in case of array we don't use it for example in gfg

    • @himanshukaushik9223
      @himanshukaushik9223 Год назад

      @@bhargavanand7325 thanks bro

  • @sahadevbhaganagare4761
    @sahadevbhaganagare4761 11 месяцев назад +296

    me first getting the optimal solution and then finding the brute 🤣🤣

    • @he_KARTIK
      @he_KARTIK 6 месяцев назад +6

      mee too😂

    • @Vikas-dm9uc
      @Vikas-dm9uc 6 месяцев назад +2

      #me2 moment

    • @user-oi1oe5he5r
      @user-oi1oe5he5r 5 месяцев назад +5

      how to remember logic ,i always forget nd cant able to code

    • @sahadevbhaganagare4761
      @sahadevbhaganagare4761 5 месяцев назад +27

      @@user-oi1oe5he5r I am not the right person but still always go back to the code after a week or so and try solving it again. Then review it after a month. That is it, it will get hard coded in your brain after that.

    • @Me_Meraj
      @Me_Meraj 4 месяца назад +3

      Bro me too 😢
      Isi wajah se easy problem solve krne me v time lgta h 😂😂 dimag me bs chlta h ki optimal hi krna h

  • @Str13011
    @Str13011 Год назад +8

    Thank you for all the tutorials,
    Please keep supporting from starting to get good placement by the help of your tutorials!

  • @arnab_16
    @arnab_16 6 месяцев назад +10

    not only your dsa knowledge is good also your communication skill, voice tone , body movement is superb 🥰🥰

  • @aryas4796
    @aryas4796 7 дней назад +1

    Who is grinding their head with DSA in their summer vacation?? Heartly thanks to striver for making us understand dsa in such depth :)

  • @satishmaurya7032
    @satishmaurya7032 Год назад +9

    What a wonderful video, it was vey good. Your way of teaching concepts through questions is best.

  • @himadriroy7980
    @himadriroy7980 8 месяцев назад +11

    I did not only enjoy the lecture but loved it too. Thanks Striver Bhaiya for explaining so lucidly. ❤

  • @architha4305
    @architha4305 21 день назад +3

    for the first time i guessed which concept can be used it might sound like a small thing but as a beginner who is just learning to code actually implementing codes without any reference and knowing which loop is used is really HUGE for me. THANK YOU SOO MUCH

    • @zenmonk29
      @zenmonk29 6 дней назад

      same for me. feels like a big leap

  • @aswinsrikanth408
    @aswinsrikanth408 9 месяцев назад +8

    Understood and what an explanation
    Love your explanation bro, just continue doing what you are doing for the coding community
    Amazing person

  • @cinime
    @cinime Год назад +2

    Understood! Fantastic explanation as always, I've enjoyed the video. Thank you very much!!

  • @itz_fuzzy6941
    @itz_fuzzy6941 4 месяца назад +16

    Munnawar Faaroqi explaining dsa questions...😂😂😂😂😂

  • @kushagramishra5638
    @kushagramishra5638 Год назад +35

    Understood 😄.
    Logic used for right rotate the array k places is that instead of rotating array right by k places I have rotated it n-k places to left .
    so code for this is -
    class Solution {
    public:
    void rotate(vector& nums, int k) {
    int n = nums.size();
    k = k % n;
    reverse(nums.begin(),nums.begin()+(n-k));
    reverse(nums.begin()+(n-k),nums.end());
    reverse(nums.begin(),nums.end());
    }
    };

    • @Miracle_shaw
      @Miracle_shaw Год назад +2

      hey, me also applied same approach

    • @itzmartin20
      @itzmartin20 10 месяцев назад +2

      same here

    • @jatinukey4062
      @jatinukey4062 8 месяцев назад +2

      Exactly right

    • @expl0itr
      @expl0itr 3 месяца назад +3

      reverse(nums.begin(), nums.end());
      reverse(nums.begin(), nums.begin() + k);
      reverse(nums.begin() + k, nums.end());
      u can do this also.

  • @senseiAree
    @senseiAree 10 месяцев назад +6

    I always thought that the optimal solution to this code was the hashset one that you did in the middle part. It blew my mind when I saw the optimal one... And that too so easy man... Wow .. just wow to your observation ❤

  • @kirankawade3424
    @kirankawade3424 9 месяцев назад +3

    Thank you so much for sharing the content free of cost!! very nicely explained too😘

  • @Being_Developer_7
    @Being_Developer_7 17 дней назад +1

    for rotating to right : (i have used k instead of d):
    void optimal(vector& nums , int k){
    int n = nums.size();
    k = k%n;
    reverse(nums.begin()+(n-k),nums.end());
    reverse(nums.begin() , nums.begin()+(n-k));
    reverse(nums.begin() , nums.end());
    }

  • @RahulKumar-bd6py
    @RahulKumar-bd6py 9 месяцев назад +1

    Your are best amongst all I found on internet hatsoff to you sir.

  • @sikanddhingra5835
    @sikanddhingra5835 6 месяцев назад +3

    bhai ki pehli video lgayi h ye mene. bohut maja aya, dil garden garden hogya bilkul. thanku bhai.😁

  • @LearnwithEase20
    @LearnwithEase20 9 месяцев назад +2

    Love your explanation sir!You always make things simpler

  • @md.ualiurrahmanrahat2400
    @md.ualiurrahmanrahat2400 11 месяцев назад +2

    Thanks for providng such amazing course for completely free. We are intended to you.

  • @puneetnj
    @puneetnj Год назад +17

    Right Shift Solution(Leetcode 189):
    k = k % arr.length;
    reverse(arr, 0, arr.length-1-k);
    reverse(arr, arr.length-1-k+1, arr.length-1);

    reverse(arr, 0, arr.length-1);

    • @hari7939
      @hari7939 Год назад +1

      Just do k=k%n, k=n-k!! as simple as that

  • @AdityaKumar-be7hx
    @AdityaKumar-be7hx Год назад +7

    Actually, there is another optimal solution for moving zeroes problem. It is similar to the function we use in quicksort algorithm (quickselect part for arranging elements around pivot).
    void Optimal2(̀vector& nums) {
    int j=-1, n=nums.size();
    for(int i=0; i

    • @nagame859
      @nagame859 Год назад +2

      Exceptionally concise👏

  • @AnshulVerma-cd1od
    @AnshulVerma-cd1od 6 месяцев назад +1

    Thank you for making such great and useful videos by taking out time from your busy schedule.

  • @codeby_chance6728
    @codeby_chance6728 28 дней назад +4

    Striver please bring string series. Much needed

  • @PonVignesh-gv1xp
    @PonVignesh-gv1xp Месяц назад +2

    Learning a lot outta this guy..

  • @MotivexBeastt
    @MotivexBeastt 5 месяцев назад +10

    Striver is the lion of this community

  • @harshitbajeta206
    @harshitbajeta206 Год назад +1

    Thank you for all the tutorials till now and much more waiting for the videos of those questions, which are in the A2Z DSA course sheet.

  • @sangeetasharma8574
    @sangeetasharma8574 Год назад +12

    Thank You Striver for such an effort.
    Your explanations and teaching is really amazing.
    Its really Valuable /priceless content :)

  • @pranshuatrey
    @pranshuatrey Год назад +1

    Love u striver, U are adding great value to my life!! This is amazing..

  • @anuragprasad6116
    @anuragprasad6116 5 месяцев назад +2

    Concise solution for move zeroes to end:
    int p = 0;
    for (int i = 0; i < n; i++)
    if (arr[i])
    swap(arr[p++], arr[i]);

  • @dhruvsolanki4473
    @dhruvsolanki4473 Год назад +1

    Clear explanation and amazing teaching.

  • @user-rh5be8bu6k
    @user-rh5be8bu6k Месяц назад

    Brother, Actually only because of you i came to know what is coding and how to perform our own logic while writing code.
    Your teaching was nice and I really love it. once before viewing your videos i may code but i don't know how it works internally, but after seeing ur videos it is very easy to understand the working ❣.
    my first own logic:
    vector temp;
    int first = arr[0];
    for(int i=1; i

  • @uttamvashisth4072
    @uttamvashisth4072 Год назад +60

    Salute to this consistency.

  • @curs3m4rk
    @curs3m4rk 4 месяца назад +1

    I recommend everyone to solve the linked leetcode problems attached as well, as the code needs to be tweaked little bit . So u can understand and do by yourself
    Great approaches Striver. thanks

  • @harshavardhan184
    @harshavardhan184 Год назад +3

    This much consistency is all we needed bhaiya🤞🤞🤞kudos to you

  • @user-fh5og9sm6r
    @user-fh5og9sm6r 3 месяца назад

    Thanks a lot sir for taking out time from your busy schedule and making videos. It takes a lot of effort. Thanks a lot.

  • @suriyavs8685
    @suriyavs8685 Год назад +3

    Hey striver wonderful video. I have a query. The code will be applicable only if the vector or array is sorted in the intersection part. So do we need to sort it again or is there any other optimal approach ?

  • @user-mc8sc1gf8q
    @user-mc8sc1gf8q 21 день назад

    done the assignment and understood each and every concept . Sir appreciate your hardwork

  • @triptisharma5550
    @triptisharma5550 21 день назад

    Your videos are awesome. I am finally learning to think about a problem and how to approach it. Thank you so much ❤️😬

  • @akshaikumar7966
    @akshaikumar7966 Год назад

    thank you so much for the series sir , it is helping a lot

  • @chiragbirla5606
    @chiragbirla5606 Год назад +9

    One thing striver.....
    In the sheet for the same question as we know there is a link attached for the gfg version and for the leetcode version but in some cases leetcode version is harder and sometimes gfg version.
    So please pick the hard problem for that

  • @tushartyagi4965
    @tushartyagi4965 8 месяцев назад +1

    Rotate right ---->>>>
    void rotate(vector& nums, int k) {
    vector temp(nums.size());
    for(int i=0; i< nums.size(); i++)
    {
    temp[(i+k)%nums.size()] = nums[i];
    }
    nums=temp;

    }

  • @chandusweety3341
    @chandusweety3341 21 день назад +1

    class Solution {
    public void rotate(int[] nums, int k) {
    int n=nums.length;
    k=k%n;
    reverse(nums,n-k,n-1);
    reverse(nums,0,n-k-1);
    reverse(nums,0,n-1);
    }
    void reverse(int arr[],int start,int end)
    {
    while(start

  • @valiant4498
    @valiant4498 5 месяцев назад +12

    Guys i just wanna ask something....r u guys doing all these problems on your own or like just watching the lectures

    • @ishanmoykhede9484
      @ishanmoykhede9484 5 месяцев назад +7

      First Understanding the problem then finding approach to solve it then if I make the correct solution then codding it in vs code and moving to nxt question and if I didn't get the solution then watching striver

  • @hey-cg3fv
    @hey-cg3fv Год назад +1

    Move zeroes question another approach with O(1) space
    int j=0;
    // Firstly taking all non- zeroes number
    for(int i=0;i O(1)

  • @PrithaMajumder
    @PrithaMajumder Месяц назад

    Raj, Thanks a lot for This Amazing Video about C++ Arrays
    Video - 2 Completed ✅

  • @kavyabanka4482
    @kavyabanka4482 Год назад

    Thanks for this amazing course

  • @user-mi6qr6ju9o
    @user-mi6qr6ju9o 5 месяцев назад

    your explanation is awesome and it is easy to understand

  • @AbhishekSingh-rp6hp
    @AbhishekSingh-rp6hp Год назад +5

    Your course is awesome wish I could have found your course a year before currently I am in 3rd year of my clg 😊

    • @anshu59kumari
      @anshu59kumari 11 месяцев назад

      From which college u r

    • @AbhishekSingh-rp6hp
      @AbhishekSingh-rp6hp 11 месяцев назад +2

      @@anshu59kumari Techno International New Town West Bengal

  • @MUKESH_KR8298
    @MUKESH_KR8298 Год назад

    thank u so much sir for providing best content for us.❤

  • @lost_hand
    @lost_hand 2 месяца назад

    Such a great lecture i wouldn't never forget these conceptss❤❤

  • @UECSoumyaRay
    @UECSoumyaRay Год назад +2

    code for right-rotation:
    void rotate(vector& nums, int k) {
    int n = nums.size();
    if (k > n) {
    k = k % n;
    }
    reverse(nums.begin(), nums.begin()+n-k);
    reverse(nums.begin()+(n-k),nums.begin()+n );
    reverse(nums.begin(), nums.begin()+n);
    }

    • @crazybro4383
      @crazybro4383 4 месяца назад

      Hii brother can you pls explain me why time complexity of intersection is O(1) and not O(n), where n is the size of larger sized array. Time stamp- 1:12:01

  • @DevashishJose
    @DevashishJose Год назад

    Understood. Thank you so much for this video.

  • @Unstoppable.Sakshi
    @Unstoppable.Sakshi 11 месяцев назад +1

    I have reached here , sir . By following your A to Z DSA course . Thanks a lot sir..

    • @bipinsingh1490
      @bipinsingh1490 9 месяцев назад

      Can u tel me is that a fee course or free course?

  • @dinimeegada9167
    @dinimeegada9167 Год назад

    Love your effort anna ❤

  • @hareshnayak7302
    @hareshnayak7302 4 месяца назад

    Understood,Thanks striver for this amazing video.

  • @chinmaymathakari9704
    @chinmaymathakari9704 7 месяцев назад +2

    Thank you so much for taking out time of your busy schedule. Can you please make such videos on Trees as well ? That will be a great help. Thanks a lot😊😊

  • @albatrossgeez6637
    @albatrossgeez6637 11 месяцев назад

    wonderfull video...i cannot express my words striver...thank you so so much

  • @sunnymishra2120
    @sunnymishra2120 Год назад

    I'm really lucky to have you as a teacher

  • @adarshrajsingh589
    @adarshrajsingh589 11 месяцев назад +1

    understood....and thank you for making such an amazing and interactive dsa playlist

    • @shivvratraghuvanshi522
      @shivvratraghuvanshi522 11 месяцев назад

      समझ मे आ रहा है?

    • @manan-543
      @manan-543 10 месяцев назад

      haa bhai acha padhata hai@@shivvratraghuvanshi522

  • @juniorboy1903
    @juniorboy1903 Год назад +1

    Understood 😉 maja aa gaya bhaiya

  • @Mythri333
    @Mythri333 5 месяцев назад

    Really it is world biggest best dsa course. 😊😊

  • @vivekbharadwaj4170
    @vivekbharadwaj4170 7 месяцев назад

    I wish I could get to know about your course in my first year, I'm in second year now, not late, btw thanks a lot (UNDERSTOOD)

  • @kumpatisupriya3947
    @kumpatisupriya3947 9 месяцев назад

    I'm grateful to you sir🙌🙌. You are the best🙏

  • @anantsingh2004
    @anantsingh2004 Год назад

    Understood Striver , well done 🙌👍

  • @soumikdutta6171
    @soumikdutta6171 20 дней назад

    Kudos to your efforts!

  • @lwnflash2123
    @lwnflash2123 2 месяца назад +1

    For the instersection question,why don't you consider temp array/vector space in addition to visted array for space complexity(brute force) ,because that too is used?.And for the optimal solution space complexity must be O(min(n1,n2)) if all elements are common??...

  • @yashsaxena7787
    @yashsaxena7787 5 месяцев назад +2

    Great! btw in the worst case of Intersection, the space complexity would be O(n1>n2?n2:n1) because whichever one is smaller matches completely with the other array and ends. P.S.- the space is for returning the answer and not solution.

  • @gm__1234
    @gm__1234 11 месяцев назад

    great explanation!

  • @oguluribrahmaiah1301
    @oguluribrahmaiah1301 9 месяцев назад

    Understood Thanks a lot Striver😍

  • @thebishalpaul
    @thebishalpaul 5 месяцев назад

    For left rotate by D places Brute can be : TC: O(n^2) if d==n
    Hence the rest two solutions shown in video will be better and optimal.
    int n=arr.size();
    while (k>0) {
    Integer temp=arr.get(0);
    for (int i = 1; i < n; i++) {
    arr.set(i-1, arr.get(i));
    }
    arr.set(n-1, temp);
    k--;
    }
    return arr;

  • @gulshankumar9896
    @gulshankumar9896 2 месяца назад

    nicely explained bhaiya ;
    thank you for this amazing video;

  • @sujitkokate4245
    @sujitkokate4245 6 месяцев назад

    that relationship at the last though!! 😂❤loved it bhaiya

  • @sanjaykrishna689
    @sanjaykrishna689 3 месяца назад +1

    left rotation to right rotation: simple approach is to think oppositely to left rotation.
    Shift all elements right of d and add to temp and push it.
    Just reverse the order of the reverse statements used in left rotation!.

  • @uditbhatia383
    @uditbhatia383 10 месяцев назад +1

    For left rotate by k - In python u cannot directly use the reverse function of lists , as slicing needs to be done in that case which would require extra space , so it's better to make custom reverse function and use that . @takeUforward

  • @mohammedsaad0761
    @mohammedsaad0761 7 часов назад

    you can also solve the move zeroes to end with this approach in a single loop :
    int i=0;
    int j=-1;
    while(i

  • @prateekbhaisora
    @prateekbhaisora Год назад

    void rotateright(vector& nums, int k) {
    k = k % nums.size();
    reverse(nums.begin(), nums.end());
    reverse(nums.begin(), nums.begin()+k);
    reverse(nums.begin()+k, nums.end());
    }

  • @jaskeeratsingh6388
    @jaskeeratsingh6388 Год назад +1

    Big fan and student sir🙏🙏
    Just a small request: kindly put system design videos before this placement season sir🙏🙏

  • @anilkumar4200
    @anilkumar4200 Год назад +3

    Why bro Why, Brute force->better-> optimal, Its really a big effort. thanks for such wonderful video series. Love the way u explain.

  • @sagarpokhriyal6926
    @sagarpokhriyal6926 Год назад

    Bhaiya you are gem 💎

  • @senpaidawwwggg
    @senpaidawwwggg Год назад +2

    two pointer approach is great ...

  • @chidambarjoshi3470
    @chidambarjoshi3470 Год назад +4

    In the brute force approach of union of arrays, you could have directly returned the set instead of taking a temp vector and copying it all over, because the set would only take the single copies of the elements are the time of insertion

    • @nashimbiswakarma
      @nashimbiswakarma Год назад +6

      bro you are right but most of the time they i.e., dsa practicing websites expect you to return the result in the form of array(for c++ vector and for Java ArrayList).

  • @crazyxyzk143
    @crazyxyzk143 Год назад +1

    // right rotation by k places
    int k;// no of rotation
    cin>>k;
    int d = k%n;
    reverse(arr,arr+(n-d));
    reverse(arr+(n-d),arr+n);
    reverse(arr,arr+n);
    for(int i: arr){
    cout

  • @guneeshbhatia4544
    @guneeshbhatia4544 9 месяцев назад

    great content!

  • @dhruvpatel0503
    @dhruvpatel0503 4 месяца назад +1

    In move zeroes to end problem we can use this also...,
    int y=0;
    for(int i=0;i

  • @tejalsaraswat
    @tejalsaraswat Год назад

    wonderfulll explanation ❣❣

  • @joydeepdas29
    @joydeepdas29 Год назад

    Understood 😄. Thank you ☺.

  • @Hi_kartik
    @Hi_kartik Год назад

    Given an integer array nums, rotate the array to the right by k steps, where k is non-negative.
    class Solution:
    def rotate(self, arr: List[int], d: int) -> None:
    n = len(arr)
    d%=n

    def reverse1(i,j,arr):
    while i

  • @prashantyelpale2855
    @prashantyelpale2855 4 месяца назад

    great explanation sir🔥🔥

  • @shivanand0297
    @shivanand0297 Месяц назад

    thankyou striver for this amazing series

  • @user-eq9mg3ws7t
    @user-eq9mg3ws7t 9 месяцев назад +1

    In MAANG interview generally the coding round is of 45 min and they ask 2-3 LC medium questions.So, approx. 15 min(discuss + solve) for 1 question if 2 medium LC question they asked. So, if we know optimal solution then discussing on brute force approach will cost us. So, any suggestion here ?

  • @tanishagarwal5992
    @tanishagarwal5992 6 месяцев назад +1

    In the three reversals, we are doing iterations just for half the time i.e O(d/2) + O((n-d)/2) + O (n/2) making it O(n) so TC as well as SC of optimal solution is better than the better solution.

  • @eakanshbhardwaj
    @eakanshbhardwaj 4 месяца назад

    43:50 its not i

  • @pranabpaul6317
    @pranabpaul6317 Год назад

    understood striver! thanks a lot. :)

  • @moulee007
    @moulee007 Год назад +1

    For left rotate for d places..how do i take the d values in temp in java?

  • @Akash-Bisariya
    @Akash-Bisariya Год назад

    Understood, Thank you😀😀

  • @yaamraj2224
    @yaamraj2224 Год назад +2

    thanks for this awesome content sir ..... next lecture sir??