83. Remove Duplicates from Sorted List
class Solution {
public:
ListNode* deleteDuplicates(ListNode* head) {
ListNode* curr = head;
while (curr != NULL)
{
ListNode *tem = curr; // Fast
while (tem != NULL && curr->val == tem->val) // TRIVERSE TILL VALUE ARE EQUAL
{
tem = tem->next;
}
curr->next = tem; // ONCE VALUE IS NOT EQUAL TO CURRENT
curr = curr ->next; // MOVE THE CURRENT
}
return head;
}
};