← 返回 meta 的题目列表Copy a Random Linked List
类型:online_judge
Given a linked list with random pointers, where each node has a pointer to the next node and a random pointer, the task is to copy this list. The list is defined as:
struct RandomLinkedList {
struct RandomLinkedList* next_ptr;
int val;
struct RandomLinkedList* random_ptr;
}
Create a new list using the same structure.
Example
Input
5 2
1 4
3 2
4 0
2 1
0 3