Close
Topic list
EASY
10 mins
Topics (Covered in this problem)
Problem solved
Skill meter
-
-
Other topics
Problem solved
Skill meter
Strings
-
-
Matrices (2D Arrays)
-
-
Sorting
-
-
Binary Search
-
-
Stacks & Queues
-
-
Trees
-
-
Graph
-
-
Dynamic Programming
-
-
Greedy
-
-
Tries
-
-
Arrays
-
-
SQL
-
-
Binary Search Trees
-
-
Heap
-
-
Bit Manipulation
-
-
Solve problems & track your progress
Checkout your overall progress in every topic here
Become
Sensei
in DSA topics
Open the topic and solve more problems associated with it to improve your skills
Check out the skill meter for every topic
See how many problems you are left with to solve for cracking any stage. Score more than zero to get your progress counted.

# Search in a Linked List

Contributed by
Arindam Majumder
Easy
0/40
Avg time to solve 10 mins
Success Rate 90 %
Share

## Problem Statement

#### Now you have been given an integer value 'K'. Your task is to check whether a node having a value equal to 'K' exists in the given linked list or not.

Detailed explanation ( Input/output format, Notes, Constraints, Images )
##### Sample Input 1:
``````2
3 6 2 7 9 -1
2
1 3 8 7 -1
5
``````
##### Sample Output 1:
``````1
0
``````
##### Explanation for Sample Input 1:
``````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.
``````
##### Sample Input 2:
``````1
1 2 3 7 -1
7
``````
##### Sample Output 2:
``````1
``````
##### Explanation for Sample Input 2:
``````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.
``````
Auto
Console