Login

All Problems

Problem title

Difficulty

Avg time to solve

Search In The Array

Easy

15 mins

Longest Decreasing Subsequence

Moderate

35 mins

Longest Subarray Zero Sum

Moderate

18 mins

Leap Year

Easy

15 mins

Number In AP

Moderate

15 mins

Divide Linked List In Two

Easy

20 mins

Network Delay Time

Easy

20 mins

Search in a Linked List

Easy

10 mins

K-th element of 2 sorted array

Hard

20 mins

Minimum Operations To Make Array Equal

Easy

10 mins

Problem

Submissions

4

Avg. time to solve

10 min

Success Rate

90%

Problem Statement

```
The first line of the input contains an integer 'T' representing the number of test cases or queries to be processed. Then the 'T' test case follows.
The first line of each test case contains space-separated integers denoting the values of nodes of the Linked List. The Linked List is terminated with -1. Hence, -1 is never a node value of the Linked List.
The third line of each test case contains a single integer 'K' which is desired to be checked in the Linked List.
For more clarity, please refer to the sample inputs.
```

```
For each test case, print 1 if the desired value 'K' exists in the Linked List; otherwise, print 0.
Print the answer for each test case in a new line.
```

```
You do not need to print anything, and it has already been taken care of. Just implement the given function.
```

```
1 <= T <= 10
1 <= L <= 10^5
1 <= data <= 10^9 and data != -1
1 <= K <= 10^9
Where 'T' represents the number of test cases, '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.
```

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

```
1
0
```

```
For the first test case, the given Linked List is
```

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

```
And for the second test case, the given Linked List is
```

```
As the value 5 is not present in the Linked list. So our answer is 0 in this case.
```

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

```
1
```

```
For the first test case, the given Linked List is
```

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

Console

Sample Test Case

Custom Test Case

Download Test Cases

Test Case 1

Test Case 2

Test Case 3

Saving Code...

Full Screen Mode

Change Language

Change Theme

Solution submission not allowed

Save Code

Reset Code