Question bank › Binary Search
Dsa Binary Search Easy

Square Root Approximation

Write a function that approximates the square root of a number using binary search. The function should return the floor value of the square root. You may assume that the number is a non-negative integer. Input: - A single line containing a non-negative integer. Output: - An integer representing the floor of the square root. Example: Input: 8 Output: 2

Key concepts

binary_searchmathematicsapproximation

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.