filmov
tv
Binary Search in Python: Integer Square Root
Показать описание
In this video, we will be writing a function that computes the integer square root of a given number as input without using any built-in square root function.
Specifically, write a function that takes a non-negative integer and returns the largest integer whose square is less than or equal to
the integer given:
Example:
Assume input is integer 300.
Then the expected output of the function should be 17 since 17 squared is 289 which is strictly less than 300. Note that 18 squared is 324 which is strictly greater than 300, so the number 17 is the correct response.
This video is one part of the Binary Search playlist on my channel. For more videos on binary search and how to apply it to various problems, check out the other videos:
The software written in this video is available at:
Do you like the development environment I'm using in this video? It's a customized version of vim that's enhanced for Python development. If you want to see how I set up my vim, I have a series on this here:
If you've found this video helpful and want to stay up-to-date with the latest videos posted on this channel, please subscribe:
Specifically, write a function that takes a non-negative integer and returns the largest integer whose square is less than or equal to
the integer given:
Example:
Assume input is integer 300.
Then the expected output of the function should be 17 since 17 squared is 289 which is strictly less than 300. Note that 18 squared is 324 which is strictly greater than 300, so the number 17 is the correct response.
This video is one part of the Binary Search playlist on my channel. For more videos on binary search and how to apply it to various problems, check out the other videos:
The software written in this video is available at:
Do you like the development environment I'm using in this video? It's a customized version of vim that's enhanced for Python development. If you want to see how I set up my vim, I have a series on this here:
If you've found this video helpful and want to stay up-to-date with the latest videos posted on this channel, please subscribe:
Комментарии