Copy List with Random Pointer (LeetCode 138)The problem Each node in a linked list has a , a pointer, and a pointer that…