Remove Duplicates from Sorted Array 2 | Leetcode 80 | Top 150 Interview questions series

Поділитися
Вставка
  • Опубліковано 22 січ 2025

КОМЕНТАРІ • 33

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

    Great intuition and the approach was perfect comparing to the complex Leetcode editorial approaches.

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

    Hey Amrita can you please finish this playlist? Not sure why you stopped making videos on this 150 interview question series. But out of all the channels on youtube I found only this channel where I was able to understand the solutions easily. Please continue making more videos. 🙏 Thank you.

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

      Hello,
      I am glad to know that the solutions presented here helped you.
      Due to some medical emergency we have reduced the pace, soon will start working on more solutions. please stay tuned.
      Thankyou for the understanding. 🙏

  • @SandraSaade
    @SandraSaade Рік тому +12

    class Solution {
    public int removeDuplicates(int[] nums) {
    int c=0;
    for(int i=0;i

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

      class Solution {
      public int removeDuplicates(int[] nums) {
      int count = 0;
      for (int i = 0; i < nums.length; i++) {
      if (count < 2 || nums[i] != nums[count - 2]) {
      nums[count] = nums[i];
      }
      }
      return count;
      }
      }

    • @roopeshmerwade6296
      @roopeshmerwade6296 21 день тому

      @@differentytaadi8182 count should be increamented

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

    Wow, what a great explanation and a beautiful algorithm!

  • @ShubhamKumar-yz2yz
    @ShubhamKumar-yz2yz Рік тому +1

    Amazing, very easy explanation, thank you

  • @muhammadomersaleem4919
    @muhammadomersaleem4919 8 місяців тому +9

    Explanation is different from the code solution. If n == nums[i-2], 'i' doesn't increment in the code but in the explanation.

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

    best explaination and clear mam, thank you so much mam

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

    I love your teaching style

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

    Crazy. Good job there.

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

    Essentially this not in constant space. Because in the for loop, you are creating another copy for the array.

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

    thank you explained well

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

    good sol and well explained

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

    In interviews they are going to ask in place modification of the array.

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

    Well Explained dear

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

    Thank u ❤❤❤

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

    Mam, it would be great if you give your linkedin profile in the description, and also tell your full name, it would help to make connection

  • @jason-rv5sp
    @jason-rv5sp 8 місяців тому

    Great explanation. the key point is nums[i] != num[i-2]. But why in the code it becomes n != nums[i-2] ?

    • @Chitty-fr6yj
      @Chitty-fr6yj 2 місяці тому +1

      because here don't follow index number directly it takes value from the array , that is the main difference between
      for(int i=0;i

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

    Continue this series please

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

    how to connect with you mam..?

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

    if array is like that 1 2 3 4 4 4 5 5 6 in that what about 2 element

  • @AyushTiwari-vv2xk
    @AyushTiwari-vv2xk Рік тому +2

    mam why this solution not working
    class Solution {
    public int removeDuplicates(int[] nums) {
    int j=0;
    for(int i=0;i

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

      class Solution {
      public:
      int removeDuplicates(vector& nums) {
      int j=2;
      int k=nums.size();
      if (k

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

      @@Sowmyakotha-lj8te see the code I will do it same

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

      bro because we not exactly comparing i with previous i-2 element

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

      @@mohammedmusaib4489 for this test case [1,1,1,2,2,3]
      if you compare with i-2 it won't work. You have to compare with j-2

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

    great

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

    Cool

  • @DeepakSingh-li1oe
    @DeepakSingh-li1oe 8 місяців тому

    respect++