Solution Review: Integer Square Root

This lesson contains the solution review for the challenge to find the largest integer whose square is less than or equal to the given integer.

We'll cover the following

First of all, let’s repeat the problem statement.

You are required to write a function that takes a non-negative integer, k, and returns the largest integer whose square is less than or equal to the specified integer k.

Algorithm #

The naive approach to solve this problem is to start from 1 and check the square of every number up until k. Have a look at the slides below:

Get hands-on with 1200+ tech skills courses.