Linear Search for a Target
Find the index of a target value, or -1 if it is missing.
Input format
The first line contains N. The second line contains N integers. The third line contains the integer TARGET.
Output format
Print the 0-based index of the first element equal to TARGET, or -1 if it does not appear.
Constraints
- Values fit in a 64-bit signed integer
- Trailing whitespace and a trailing newline are ignored by the judge
Read from stdin, write to stdout. Sample cases below show the exact format.
Sample cases
Example 1
Input
5
4 8 15 16 23
15Expected output
2Example 2
Input
4
1 2 3 4
9Expected output
-1