#B2093. Find the First Occurrence in a Sequence

    ID: 11175 Type: Default 1000ms 256MiB

Find the First Occurrence in a Sequence

Find the First Occurrence in a Sequence

Given a sequence with indices starting from \(0\), you are required to find the first occurrence of a given target value in the sequence and output its index.

inputFormat

The input consists of three lines:

  1. The first line contains an integer \(n\) representing the number of elements in the sequence.
  2. The second line contains \(n\) integers separated by spaces.
  3. The third line contains an integer representing the target value to search for.

outputFormat

Output the index (0-indexed) of the first occurrence of the target value in the sequence.

sample

5
1 2 3 2 1
2
1