<jupyter_start><jupyter_text>2020년 9월 29일 화요일 leetCode - Remove Linked List Elements (Python) 문제 : https://leetcode.com/problems/remove-linked-list-elements/ 블로그 : https://somjang.tistory.com/entry/leetCode-203-Remove-Linked-List-Elements-Python  첫번째 시도<jupyter_code># Definition for singly-linked list.
# class ListNode:
#     def __init__(self, val=0, next=None):
#         self.val = val
#         self.next = next
class Solution:
    def removeElements(self, head: ListNode, val: int) -> ListNode:
        while head and head.val == val:
            head = head.next
        if not head:
            return head

        next_node = head
        while next_node and next_node.next:
            if next_node.next.val == val:
                next_node.next = next_node.next.next
            else:
                next_node = next_node.next

        return head<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09977578475336323, 'fraction_numerical': 0.01233183856502242, 'mean_word_length': 2.357142857142857, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '480558', 'license': 'MIT', 'n_tokens_mistral': 305, 'n_tokens_neox': 304, 'n_words': 67, 'path': 'DAY 201 ~ 300/DAY222_[leetCode] Remove Linked List Elements (Python).ipynb', 'repo_name': 'SOMJANG/CODINGTEST_PRACTICE', 'size': '892'}