Facebook | E4 | Seattle | Phone Interview

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

Interview Experience: Meta (Facebook) | E4 | Phone Interview | Seattle

Company: Meta (Facebook)

Role: E4 (SWE II)

Interview Stage: Phone Interview

Location: Seattle

Year: unknown


I got 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(char 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