Sequential search in an array

Write a function that tells if the integer number @x@ is present in the vector of integer numbers @v@.

In order to compare the efficiency of your solution against the efficiency of the solution of the Judge, start searching for @x@ from the lowest positions.

Interface

C++
bool exists(int x, const vector<int>& v);
C
int exists(int x, const int v[], int vsize);
Java
public static boolean exists(int x, int[] v);
Python
exists(x, v)  # returns bool
exists(x: int, v: list) -> bool

Observation

You only need to submit the required procedure; your main program will be ignored.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T09:59:13.435Z

© Jutge.org, 2006–2026.
https://jutge.org