Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution:
- def delete_node(self, head, x):
- #code here
- current = head
- indexx = 1
- while head != None:
- if indexx == x:
- nex = head.next
- pre = head.prev
- if pre != None:
- pre.next = nex
- else:
- current = nex
- break
- indexx += 1
- head = head.next
- return current
Advertisement
Add Comment
Please, Sign In to add comment