自己1:嘿嘿,首先想到的就是python库中的copy,哈哈,作弊一把
"""
# Definition for a Node.
class Node:
def __init__(self, x, next=None, random=None):
self.val = int(x)
self.next = next
self.random = random
"""
class Solution(object):
def copyRandomList(self, head):
"""
:type head: Node
:rtype: Node
"""
from copy import deepcopy
res = deepcopy(head)
return res