C Code | Easy Explanation w/ Commented Code | Faster than 100.00% | Easy Understanding
\n/**\n * Definition for singly-linked list.\n * struct ListNode {\n *     int val;\n *     struct ListNode *next;\n * };\n */\n\n\nstruct ListNode* deleteDupli
```\n/**\n * Definition for singly-linked list.\n * struct ListNode {\n *     int val;\n *     struct ListNode *next;\n * };\n */\n\n\nstruct ListNode* deleteDuplicates(struct ListNode* head){\n     //if head is NULL or just having a single node, simply return from here head \n    if(head == NULL || head -> next == NULL)\n        return head;\n    \n    // creating our dummy node i.e prehead\n        // we are giving it\'s value is -101, because see constraints\n        // -100 <= Node.val <= 100\n    struct ListNode* prehead = (struct ListNode*)malloc(sizeof(struct ListNode));\n    \n    prehead -> val = -101;\n    prehead -> next = head; // prehead\'s next contain head\n    \n    struct ListNode* curr = prehead; // make a current pointer to move\n    \n    // while it not reaches to the end\n    while(curr -> next != NULL && curr -> next -> next != NULL)\n    {\n        // if values are equal, now we have to delete values, till when they are equal\n        if(curr -> next -> val == curr -> next -> next -> val)\n        {\n            struct ListNode* temp = curr -> next -> next;\n            \n            while(temp != NULL && curr -> next -> val == temp -> val)\n            {\n                struct ListNode* anthortemp = temp;\n                temp = temp -> next;\n                \n                free(anthortemp); // actually freeing up the memory\n            }\n            \n            curr -> next = temp;\n            \n        }\n        else // if values are not equal\'s then simply move curr to next\n        {\n            curr = curr -> next;\n        }\n    }\n    \n     // and at last, prehead\'s next contain head node, so return that\n    return prehead -> next;\n}\n```
['C']