# Challenge: Union and Intersection of Linked Lists — Hashing

Try to solve the Union and Intersection of Linked Lists — Hashing problem.

## We'll cover the following

## Statement

Given two linked lists as inputs containing integer values, implement the union and intersection functions for the linked lists. The order of elements in the output lists doesn’t matter.

Here’s how to implement the functions:

**Union**This combines elements from two sets, removing duplicates, to form a new set with all unique elements from both original sets. **:**This function will take two linked lists as input and return a new linked list containing all the unique elements.**Intersection**This identifies and collects elements that are common to both sets, excluding all others, to create a set of shared elements. **:**This function will take two linked lists as input and return all the common elements between them as a new linked list.

**Constraints:**

Let `n`

be the number of nodes in both linked lists:

$0 \leq$ `n`

$\leq 5 \times 10^2$ $-5 \times 10^3 \leq$ `node.data`

$\leq 5 \times 10^3$

## Examples

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.