Linear Search
Statement
Linear Search is an algorithm that is used to search an integer in an array,
How this works, For Example, You have an array [[A]] = {{1}} {{2}} {{4}} {{3}}
and you need to find an integer [[K]] = {{4}}, Firstly you will check the first element, 1 is not 4, 2 is not 4, 4 is 4, and the index of 4 in the array is, 3, so return 3
Input description
An integer [[n]] the size of the array
An integer [[k]] the integer you need to search
An array [[a]]
Output description
Output, The index of [[k]] in [[a]]
Constraints
1 <= [[n]] <= 100
1 <= [[k]] <= 100
1 <= [[a]].length <= 100
Game modes
Fastest, Shortest, Reverse
Test cases
Test 1 Test
Input
5
2
1 2 3 4 5
Output
2
Validator 1 Validator
Input
5
3
5 4 1 2 3
Output
5
Test 2 Test
Input
6
3
1 4 3 5 2 1
Output
3
Validator 2 Validator
Input
6
8
1 3 4 5 6 8
Output
6
Test 3 Test
Input
2
1
2 1
Output
2
Validator 3 Validator
Input
5
3
1 4 2 3 5
Output
4
Test 4 Test
Input
3
3
1 2 3
Output
3
Validator 4 Validator
Input
4
3
1 3 2 4
Output
2
Solution language
Solution
Stub generator input