Question bank › Binary Search
Dsa Binary Search Warm-up

Locate Target in a Sorted Array

Given a sorted array of integers, write a function to find the index of a target value. If the target is not found, return -1. Input Format: - The first line contains space-separated integers (sorted array). - The second line contains an integer (target). Output Format: - An integer representing the index of the target or -1 if not found. Example: Input: 1 2 3 4 5 3 Output: 2

Key concepts

binary_searcharraysearch

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.