Question bank › Binary Search
Dsa Binary Search Medium

Temperature Threshold

You are given a list of temperature readings over a week (7 days), and a threshold temperature. Write a function that finds the minimum day index where the temperature first equals or exceeds the threshold. If the temperature never meets the threshold, return -1. Input format: - The first line contains 7 space-separated integers representing the daily temperature readings. - The second line contains an integer representing the threshold temperature. Output format: - Output the minimum index (0-based) where the temperature first meets or exceeds the threshold, or -1 if it does not. Example: Input: 30 32 35 29 28 30 31 30 Output: 0

Key concepts

binary_searchintervals

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.