Question bank › Binary Search
Dsa Binary Search Medium

Height Search

You are provided with a sorted list of student heights and a target height. Write a function that finds the smallest index at which a student has a height greater than or equal to the target height. If no student meets the criteria, return -1. Input Format: A single line containing space-separated integers (student heights) followed by the target height. Output Format: The index of the first student with a height that meets or exceeds the target height, or -1 if not found. Example: Input: 150 160 165 170 175 180 185 190 175 Output: 4

Key concepts

binary_searcharrayssearching

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.