https://leetcode.com/problems/remove-duplicates-from-sorted-list-ii


Runtime: 56 ms, faster than 16.66% of Python3 online submissions for Remove Duplicates from Sorted List II.
Memory Usage: 14.3 MB, less than 26.49% of Python3 online submissions for Remove Duplicates from Sorted List II.



```python
class Solution:
    def deleteDuplicates(self, head: ListNode) -> ListNode:
        #6:31
        if head == None:
            return None
        
        node_list = []
        value_list = []
        duplicates = []
        
        node = head
        while node:
            node_list.append(node)
            if (node.val in value_list):
                duplicates.append(node.val)
            else:
                value_list.append(node.val)
            node = node.next
        
        new_node_list = []
        for node in node_list:
            if node.val not in duplicates:
                new_node_list.append(node)
                
        for index, node in enumerate(new_node_list):
            if (index != len(new_node_list) - 1):
                node.next = new_node_list[index+1]
            else:
                node.next = None
        
        if len(new_node_list) == 0:
            return None
        else:
            return new_node_list[0]
        #6:39
        #debug until 6:41
```