Facebook | E4 | Seattle | Phone Interview

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2020-03-18Added By Anonymous
Source: Link

Company: Meta (Facebook)
Role: e4
Interview Stage: Phone Screen
Location: Seattle
Year: unknown

Original Post Content:

I got a one coding question.

public class Node{
public char value; // this value is not unique
public Node next; // pointer for next node
public Node random; // pointer for any random node in the list

public Node( value){
this.value = value;
}

//example the next pointer 1-> 2->3->4
// example random pointer 1->3, 2-> null., 3-> null , 4-->1

You have implement a method to clone this List

Node clone( Node root){
// you have to clone the list and return root Node of new list
// your code
}

Comments