← Problem library

Searching · Python

Linear Search

EasySearchingUnsolved

Problem

Search nums from left to right and return target's first index.

Example input

nums = [5, 2, 8], target = 2

Example output

1

Constraints

0 <= len(nums) <= 1000

Python workspace

Reset code

Execution uses a timed child process in a temporary directory. It is development-only isolation, not a production sandbox.