## Solutions

### Python 作弊解法

# -*- coding:utf-8 -*-
# class RandomListNode:
#     def __init__(self, x):
#         self.label = x
#         self.next = None
#         self.random = None
class Solution:
# 返回 RandomListNode
# write code here
import copy

### 拆解的方法

# -*- coding:utf-8 -*-
# class RandomListNode:
#     def __init__(self, x):
#         self.label = x
#         self.next = None
#         self.random = None
class Solution:
# 复制原始链表的每个结点, 将复制的结点链接在其原始结点的后面
while pNode:
new_Node = RandomListNode(pNode.label)
new_Node.next = pNode.next
pNode.next = new_Node
new_Node.random = None

pNode = new_Node.next

# 将复制后的链表中的克隆结点的random指针链接到被克隆结点random指针的后一个结点
while pNode:
if pNode.random:
pNode.next.random = pNode.random.next
pNode = pNode.next.next

# 拆分链表：将原始链表的结点组成新的链表, 复制结点组成复制后的链表
pNode.next = pClonedNode.next
pNode = pNode.next
while pNode:
pClonedNode.next = pNode.next
pClonedNode = pClonedNode.next
pNode.next = pClonedNode.next
pNode = pNode.next

# 返回 RandomListNode
# write code here
return None

### 递归方法

# -*- coding:utf-8 -*-
# class RandomListNode:
#     def __init__(self, x):
#         self.label = x
#         self.next = None
#         self.random = None
class Solution:
# 返回 RandomListNode