Login

All Problems

Problem title

Difficulty

Avg time to solve

Valid Boomerang

Easy

10 mins

Maximum Shares

Easy

30 mins

Homogenous Substrings

Easy

15 mins

Hourglass Pattern

Moderate

--

Score After Flipping Matrix

Moderate

25 mins

Maximum profit

Moderate

40 mins

Ninja and the game

Hard

45 mins

MaxFreq_Element

Moderate

15 mins

Sum of Dependencies in a Graph

Easy

20 mins

Fixed Point

Easy

15 mins

Problem

Submissions

0

Avg. time to solve

15 min

Success Rate

85%

Problem Statement

```
1.Note that the array contains negative integers as well.
2. Also, note that every array contains a single fixed point.
```

```
Given Array = [-1, 1, 3, 5]
In the above example 'ARR[1]' == 1, so you need to return 1.
```

```
The first line contains an integer ‘T’ which denotes the number of test cases.
The first line of each test case contains a single integer ‘N’, denoting the size of the input array.
The next line contains ‘N’ space-separated integers denoting the elements of the array.
```

```
For each test case, you need to return a single integer denoting the index or value at which 'ARR[i]' == 1. In case no such value exists, return -1.
Print the output of each test case 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 <= 10
1 <= N <= 10000
-10^9 <= ARR[i] <= 10^9
Where 'ARR[i]' denotes element at the the 'i'th index.
Time limit: 1 sec
```

```
2
4
-1 1 3 5
3
1 2 3
```

```
1
-1
```

```
In test case 1, 'ARR[1]' == 1, so you need to return 1.
In test case 2, No such value present, so you need to return -1.
```

```
2
4
-1 0 2 4
5
-2 -1 0 1 2
```

```
2
-1
```

```
In test case 1, 'ARR[2]' == 2, so you need to return 2.
In test case 2, No such value present, so you need to return -1.
```

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