'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

You are given a Singly Linked List of integers with a head pointer. Every node of the Linked List has a value written on it.

A sample Linked List:

Now you have been given an integer value, * 'K'*. Your task is to check whether a node with a value equal to 'K' exists in the given linked list. Return 1 if node exists else return 0.

Detailed explanation

```
3 6 2 7 9 -1
2
```

```
1
```

```
As value 2 exists in the given linked list. So we will return 1 in this case.
```

```
1 2 3 7 -1
7
```

```
1
```

```
As the value 7 exists in the Linked List, our answer is 1.
```

```
Try solving this in O(L).
```

```
1 <= 'L' <= 10^5
1 <= 'data' <= 10^9 and 'data' != -1
1 <= 'K' <= 10^9
Where 'L' represents the total number of nodes in the Linked List, 'data' represents the value at each node, and 'K' is the given integer.
Time Limit: 1 sec.
```