CindyDorantes / Binary-search

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to solve this challenge?

  1. Read the "Challenge description" below.
  2. Make changes to the challenge.js file.
  3. Commit your changes.
  4. Wait for the result of the "GitHub Classroom Workflow" action. If it is green - congratulations, you solved this challenge! If not - try again!
  5. You can watch an example of how to solve a challenge in the video linked in the theoretical lesson preceding this challenge.

Challenge description

Binary Search

The method sqrt takes in one square number.

Fill the method sqrt_recursive that returns the square root of a given number. Do not use any built in methods for calculating the square-root and don't try searching through all the numbers. Instead, use a binary-style search to home in on the actual square root. (To make it simpler, the input will just contain square numbers.)

Examples

console.log(sqrt(25))
// => 5

console.log(sqrt(7056))
// => 84

Troubleshooting

If you cannot see any auto-grading workflows on the Actions page, learn how to fix it in this repo.

About


Languages

Language:JavaScript 100.0%