We hope you all are enjoying our videos!!! Don't forget to leave a comment!!! Please like the video to support us!!! Questions you might like: ✅✅✅[ Tree Data Structure ] : kzbin.info/aero/PLJtzaiEpVo2zx-rCqLMmcFEpZw1UpGWls ✅✅✅[ Graphs Data Structure ] : kzbin.info/aero/PLJtzaiEpVo2xg89cZzZCHqX03a1Vb6w7C ✅✅✅[ January Leetcoding Challenge 2021 ] : kzbin.info/aero/PLJtzaiEpVo2wCalBcRcNjXQ0C6ku3dRkn ✅✅✅[ December Leetcoding Challenge 2020 ] : kzbin.info/aero/PLJtzaiEpVo2xo8OdPZxrpybGR8FmzZpCA ✅✅✅[ November Leetcoding Challenge 2020 ] : kzbin.info/aero/PLJtzaiEpVo2yMYz5RPH6pfB0wNnwWsK7e ✅✅✅[ August Leetcoding Challenge 2020 ] : kzbin.info/aero/PLJtzaiEpVo2xu4h0gYQzvOMboclK_pZMe ✅✅✅ [ July Leetcoding Challenge 2020] : kzbin.info/aero/PLJtzaiEpVo2wrUwkvexbC-vbUqVIy7qC- ✅✅✅ [ June Leetcoding Challenge 2020 ] : kzbin.info/aero/PLJtzaiEpVo2xIfpptnCvUtKrUcod2zAKG ✅✅✅ [May Leetcoding Challenge 2020 ] : kzbin.info/aero/PLJtzaiEpVo2wRmUCq96zsUwOVD6p66K9e ✅✅✅Cracking the Coding Interview - Unique String: kzbin.info/aero/PLJtzaiEpVo2xXf4LZb3y_BopOnLC1L4mE Struggling in a question?? Leave in a comment and we will make a video!!!🙂🙂🙂
@mengyuanzhang928817 күн бұрын
This is literally the most vivid explanation I've ever seen. THANK YOU SOOO MUCH!! Finally understood how to remove duplicates from a sorted list. I had struggled for hours.
@AlgorithmsMadeEasy8 күн бұрын
happy to help!! Please like, share and subscribe to the channel.
@poetryiscodingdecoding79652 жыл бұрын
Literally this is the best explanation for this question ...The way she developed the intuation and then coded ..not even found helpful on others channel and even foreigners...
@AlgorithmsMadeEasy2 жыл бұрын
Glad you enjoyed it!
@harinijeyaraman87893 жыл бұрын
This video has such a crisp and precise explanation at the beginning. Found this very helpful !
@AlgorithmsMadeEasy3 жыл бұрын
Thanks ! Glad tou liked it !! Keep learning.
@badabeta6973 Жыл бұрын
this is the best explanation I found so far
@ashishshahpur71053 жыл бұрын
This solution is good for Java as there is automatic garbage collection. In case of C++, it will run perfectly but there will be memory leaks as the memory on the heap will never get cleared. How do we approach this in that case?
@demohamnead86625 ай бұрын
Free the memory before the program ends?
@ziyadauti3676 Жыл бұрын
Best explanation compared to all other videos on this question #82 ....🤗
@consistentthoughts8264 жыл бұрын
Very good explanation I was not able to visualise like this Now I am able to solve
@AlgorithmsMadeEasy4 жыл бұрын
Thanks @Renuka Glad you liked it !! Keep learning, happy coding !!!
@nitin45982 жыл бұрын
Great visualization with pointers !.. My code was giving errors for some edge cases, then watched your video and it helped me. Thank you
@AlgorithmsMadeEasy2 жыл бұрын
Glad you liked it !!
@shakti051 Жыл бұрын
Explained so clear and precise
@aviralkaushik94252 жыл бұрын
such a great Explanation,, I did not understand the dummy, or what it's working,, but now I totally understand, thank you so much mam🤗
@arjunreddynarala Жыл бұрын
Great Explanation👌👌, keep doing for more problems.Its a request.
@lavanya_m013 жыл бұрын
Awesome explanation!! Thanks :)
@AlgorithmsMadeEasy3 жыл бұрын
Glad you liked it!!
@aby.t2 жыл бұрын
great explaination and visual, keep it up!
@AlgorithmsMadeEasy2 жыл бұрын
Glad it was helpful!
@anishsuman13714 жыл бұрын
visualization of pointer is very important i like your presentation
@AlgorithmsMadeEasy4 жыл бұрын
Thanks @Anish 🙂
@listentobooks35922 жыл бұрын
Great Help 😇thanks
@AlgorithmsMadeEasy2 жыл бұрын
Happy to help
@anujtiwari72182 жыл бұрын
great explanation mam,
@AlgorithmsMadeEasy2 жыл бұрын
Glad you enjoyed it!
@sharuk35453 жыл бұрын
one of the best Solution
@AlgorithmsMadeEasy3 жыл бұрын
Thanks!! 😁
@cp65143 Жыл бұрын
Clear and really helpful😇
@sophia02822 жыл бұрын
Thank you sooooo much for the explanation. I had tried to demo the process by myself and got confused.
@AlgorithmsMadeEasy2 жыл бұрын
Glad you liked it !!
@shantanukumar40813 жыл бұрын
great explanation
@AlgorithmsMadeEasy3 жыл бұрын
Glad it was helpful!
@asifkhan-jk4po4 жыл бұрын
Explained it nicely.
@AlgorithmsMadeEasy4 жыл бұрын
Thanks @asif !!
@vedantagarwal224 жыл бұрын
Very good explanation . Thankyou !!!
@AlgorithmsMadeEasy4 жыл бұрын
Thanks @Vedant 🤗
@rohandas4172Ай бұрын
Best solution
@AlgorithmsMadeEasyАй бұрын
Thank you!!!
@bellanatrisha1201 Жыл бұрын
thank you so much
@AlgorithmsMadeEasy Жыл бұрын
You're welcome!
@RAJ_K_7 ай бұрын
well explained!
@AlgorithmsMadeEasy7 ай бұрын
Thanks
@siddharthdwivedi32633 жыл бұрын
Very nice explaination!!
@AlgorithmsMadeEasy3 жыл бұрын
Thanks
@prathameshraut657911 ай бұрын
We have used while inside while loop so time complexity will be O(n2) right? Correct me please if I am wrong...
@Apoorvpandey2 жыл бұрын
Clean explaination!
@adityasrivastava81963 жыл бұрын
Awesome Explanation Ma'am !!!!
@AlgorithmsMadeEasy3 жыл бұрын
Thank you! 🙂
@himanshusharma10663 жыл бұрын
simply amazing solution:-)
@AlgorithmsMadeEasy3 жыл бұрын
Thanks !!
@binu444644 жыл бұрын
nice explanation
@AlgorithmsMadeEasy4 жыл бұрын
Thanks !! 😀
@hydrocy.91657 ай бұрын
2:34 why not prev = head->next?
@noobff56243 ай бұрын
Bcs if we move prev is equal to head ->next then the value 4 will also come that we do not want and this will update the prev That is why we do prev next is equal to head next so we can change prev next any time
@ishaankulkarni493 жыл бұрын
great video. how do we know when to use a dummy node?
@khushinaudiyal27862 жыл бұрын
I wanna know the same thing!
@codersgarage22794 жыл бұрын
Well explained. thanks
@AlgorithmsMadeEasy4 жыл бұрын
Thanks @Sudha. Happy coding !!!
@sampannapokhrel Жыл бұрын
A little confusing. When the head moves from 3 to 4, as said earlier in the video why didn't you move the prev to 4 as well and if you move the prev the algo doesn't work.
@Idk-qg7hb Жыл бұрын
awesome video, thanks
@kuldeepparmar6782 Жыл бұрын
mam if you use ListNode dummy = new ListNode(0); does it give same result why we should use ListNode dummy = new ListNode(0, head);
@yereneager Жыл бұрын
if u use first ListNode dummy = new ListNode(0), then in next line you need to also specify dummy.next = head, both are same thing
@korosensei37803 жыл бұрын
how will duplicate->next return only the required nodes ?
@PankajYadav-kf3dl2 жыл бұрын
Mam at the end, "prev" pointer will also come to node 5, right?
@systemforge3 жыл бұрын
Brilliant
@pydjango98123 жыл бұрын
Thanks
@bhupeshbhatt48492 жыл бұрын
Crisp | करारा
@AlgorithmsMadeEasy Жыл бұрын
👌👌
@naveenyadav37003 жыл бұрын
🥰 great
@AlgorithmsMadeEasy3 жыл бұрын
Thanks !!
@shivendrayadav39913 жыл бұрын
Time Complexity you explained is Wrong ... In best case it would be O(n) else it will be O(n)^2.
@sahilbarua52022 жыл бұрын
no it will always be o(n) cause the outer loop does not iterates over the skipped element that inner loop does
@sssumeet2 жыл бұрын
great
@gantakailashnath Жыл бұрын
Can anyone tell me why this code is getting runtime error in gfg. Node* removeAllDuplicates(struct Node* head) { //code here Node* dummy=new Node(0); dummy->next=head; Node* prev=dummy; Node* temp=head; Node* nextnode=temp->next; while(nextnode!=NULL) { if(temp->data==nextnode->data) { while(temp->data==nextnode->data && nextnode!=NULL) { nextnode=nextnode->next; } prev->next=nextnode; temp=nextnode; nextnode=nextnode->next; } else { prev=temp; temp=nextnode; nextnode=nextnode->next; } } return dummy->next; }
@louischou67803 жыл бұрын
why do we need to do head = head.next in line 27?
@manojpatil73513 жыл бұрын
If values are not equal we need to move both prev and head so after moving prev we move head
@SatishKanaujiyaeb3 жыл бұрын
Edge case this solution will fail when when size =1
@adityachowdhury202 жыл бұрын
How it is O(n)?
@cricsinghvlogz4 жыл бұрын
nice
@AlgorithmsMadeEasy4 жыл бұрын
Thanks Pawan 👍👍
@xinniu31453 жыл бұрын
When I conver this to python, it does not work, could anyone explain that to me? Thank you! class Solution: def deleteDuplicates(self, head: Optional[ListNode]) -> Optional[ListNode]: dummy = ListNode(0, head) prev = dummy while head: if head.next and head.next.val==head.val: while head.next and head.next.val==head.val: head = head.next prev = head.next else: prev = prev.next head = head.next return dummy.next
@xinniu31453 жыл бұрын
Hi, could anyone explain why dummy will point to the first non-duplicate node in the code? when you run prev.next = head.next, the dummy.next will also point to head.next, right? why this is the case? And why dummy just stop at the first non-duplicate node and won't go to the end of the list when you run prev = prev.next?
@dillitimalsina60032 жыл бұрын
actually you are blurred my brother....yes when prev.next points to head.next dummy.next also points to head.next but if head.val!=head.next.val we shifted our pre=prev.next so only the referernce pre is shifted the actual object isn't been modified .so for that reason dummy sticks to the very first.....Thanks
@ranbirpalsingh22452 жыл бұрын
Can anyone explain how actually the dummy pointer is getting changed?
@ranbirpalsingh22452 жыл бұрын
Eg. If we create temp= head pointer whatever changes we make to temp will not get reflected in head pointer then how the dummy pointer is getting modified?
@devinpadron59 ай бұрын
@@ranbirpalsingh2245 The "dummy" and "prev" share the same node. So when prev->next is changed, it is also changed for the dummy.
@kaustavsaha11172 жыл бұрын
Does someone copy ur code ? 🤣
@vaishnavworkprofile54783 жыл бұрын
@rkk19903 жыл бұрын
Isn't this a incorrect explanation? We have to just remove the value which is duplicated. Instead you have removed the value itself which is duplicated. Example : 1 -> 2 -> 3 -> 3 -> 4 -> 4 -> 5 ==> 1 -> 2 -> 3 -> 4 -> 5
@Nk226183 жыл бұрын
The question requires only distinct numbers present in original list. So 3 and 4 are not included in the answer