'Coding has over 700 languages', '67% of programming jobs aren’t in the
technology industry', 'Coding is behind almost everything that is powered
by electricity'

Topics

A doubly-linked list is a data structure that consists of sequentially linked nodes, and the nodes have reference to both the previous and the next nodes in the sequence of nodes.

You’re given a doubly-linked list and a key * 'k'*.

Delete all the nodes having data equal to ‘k’.

```
Input: Linked List: 10 <-> 4 <-> 10 <-> 3 <-> 5 <-> 20 <-> 10 and ‘k’ = 10
Output: Modified Linked List: 4 <-> 3 <-> 5 <-> 20
Explanation: All the nodes having ‘data’ = 10 are removed from the linked list.
```

Detailed explanation

```
7
10 4 10 3 5 20 10
10
```

```
4 3 5 20
```

```
All the nodes having ‘data’ = 10 are removed from the linked list.
```

```
7
10 4 10 3 5 20 10
30
```

```
10 4 10 3 5 20 10
```

```
The linked list does not have any node with ‘data’ = 30. So the linked list is unchanged.
```

```
The expected time complexity is O(‘n’).
```

```
0 <= ‘n’ <= 100000
1 <= ‘data’ in any node <= 10^9
1 <= ‘k’ <= 10^9
```