Removing duplicates from 2 linked lists
<p>I was asked in an interview this question</p>

<p>LinkedList A has {1,2,3,4,5,6} </p>

<p>LinkedList B has {1,3,5}</p>

<p>I needed to write a method which would return back a Set which does not contain the duplicate elements in list A and B </p>

<p>result { 2,4,6}</p>

<p>I wrote a solution which would iterate over first list and if it does not exist in the second list then add it to a HashSet. But need a solution which performs better than the suggested Algorithm.</p>

<p>No space constraint mentioned for solving this.</p>

<p>Would definitely like a solution using JDK ,but would prefer a solution which is algorithm based</p>

<p>Thanks a ton</p>
