New update is available. Click here to update.

Last Updated: 27 Feb, 2021

Difficulty: Easy

```
Let ‘ARR’ = {2 4 7 10}.
If you want to know that what is the value at the 0-index in ‘ARR’, use ‘readValueAtIndex(0)’. Then the output is 2.
Let’s assume that you are trying to get the value at the 10’th index so, use ‘readValueAtIndex(10)’. Then the output is ‘10 ^ 9 + 7’. Because you are trying to access an index that is greater than the size of ‘ARR’.
```

```
The first line of input contains an integer ‘T’ which denotes the number of test cases.
The first line of each test case contains a space-separated integer ‘N’ and ‘TARGET’, which represents the size of ‘ARR1’ and an element to be searched.
The next lines of each test case contain ‘N’ space-separated integers which represent the elements of ‘ARR1’.
```

```
For each test case, return the position of the element ‘TARGET’ if it is present in the ‘ARR’ otherwise return -1.
Output for each test case should be in a separate line.
```

```
You don't need to print anything, it has already been taken care of. Just implement the given function.
```

```
1 <= ‘T’ <= 100
1 <= ‘N’ <= 5000
1 <= ‘ARR1[i]’, ‘TARGET’ <= 100000
Where ‘ARR1[i]’ the element of the array 'ARR'.
Time Limit: 1 sec
```

SIMILAR PROBLEMS

Batteries

Posted: 7 Oct, 2022

Difficulty: Hard

Find The Single Element

Posted: 30 Oct, 2022

Difficulty: Easy

Find minimum

Posted: 8 Nov, 2022

Difficulty: Hard

Search In A Sorted 2D Matrix

Posted: 23 Nov, 2022

Difficulty: Moderate

Fake Coin Problem

Posted: 24 Dec, 2022

Difficulty: Easy

Popular Interview Problems: