i dont understand how take input in this problem
How take input in this problem
@sksumitkumardiwaker,
Create 2 objects of the linked list class and pass them into the intersection method.
You can create:
LinkedList list1 = new LinkedList();
and
LinkedList list2 = new LinkedList();
Write an add last method in Linked List and pass the input into that:
public void addLast(int data){
Node newNode=new Node(data);
this.size++;
if(head==null){
head=newNode;
tail=newNode;
return;
}
tail.next=newNode;
this.tail=newNode;
}