# remove node at given index from linked list

class Node(object):
    def __init__(self, value, next=None):
        self.value = value
        self.next = next

# ll = (head, head.next)
head = Node(3)
head.next =  Node(2, Node(3, Node(6, Node(7, Node(9)))))

def delete_node(ll, index):
    if index == 0:
        return ll.next
    if ll is None:
        return None
    else:
        head = Node(ll.value)
        # recursion
        tail = delete_node(ll.next, index-1)
        head.next = tail
        return head



d58540cc9392ef90baafa1bc45b55ff0f949f6be
<mask token>

class Node(object):

    def __init__(self, value, next=None):
        self.value = value
        self.next = next


<mask token>

class Node(object):

    def __init__(self, value, next=None):
        self.value = value
        self.next = next


<mask token>


def delete_node(ll, index):
    if index == 0:
        return ll.next
    if ll is None:
        return None
    else:
        head = Node(ll.value)
        tail = delete_node(ll.next, index - 1)
        head.next = tail
        return head

class Node(object):

    def __init__(self, value, next=None):
        self.value = value
        self.next = next


head = Node(3)
head.next = Node(2, Node(3, Node(6, Node(7, Node(9)))))


def delete_node(ll, index):
    if index == 0:
        return ll.next
    if ll is None:
        return None
    else:
        head = Node(ll.value)
        tail = delete_node(ll.next, index - 1)
        head.next = tail
        return head

# remove node at given index from linked list

class Node(object):
    def __init__(self, value, next=None):
        self.value = value
        self.next = next

# ll = (head, head.next)
head = Node(3)
head.next =  Node(2, Node(3, Node(6, Node(7, Node(9)))))

def delete_node(ll, index):
    if index == 0:
        return ll.next
    if ll is None:
        return None
    else:
        head = Node(ll.value)
        # recursion
        tail = delete_node(ll.next, index-1)
        head.next = tail
        return head


