67. Find the Roll Number

Acceptance — 0 accepted 0 submissions

Easy
ArraysSearching
No companies listed
The exam hall list has n roll numbers in the order students are seated. The invigilator wants to know the seat position of roll number x.

Print the index (starting from 0) where x appears first, or -1 if x is not in the list.

Input Format
The first line has n.
The second line has n integers.
The third line has x.

Output Format
Print the first index of x (0-based), or -1.

Constraints
• 1 ≤ n ≤ 1000
• 1 ≤ values, x ≤ 10^6

Example 1

Input
5
101 205 150 340 205
205
Output
1

Explanation 205 is first found at index 1 (the second seat).

Example 2

Input
3
11 22 33
44
Output
-1

Explanation 44 is not in the list.

Example 3

Input
4
9 8 7 6
9
Output
0

Explanation Found right at the start, index 0.

Acceptance —
Accepted 0
Submissions 0
Auto-save
Saved Ln 1, Col 1
Submit a solution to see its status here.
Input
Expected Output
1
No results yet
Run your code to test it against the sample cases.
Problem List