# searching advanced

The Fewest Guesses Challenge

Grand finale! ⚡ Two robots hunt the same target in the same SORTED list. Slowbot checks one spot at a time from the start; Zoombot splits the list in half. Count each robot's checks!

You get the sorted nums and a target that's present. Print two lines: slowbot <checks> and zoombot <checks>.

Example:

Input: nums = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32], target = 30 Output:

slowbot 15
zoombot 4

Slowbot checks one spot at a time and needs 15 checks to reach 30 (the 15th item). Zoombot halves the range each guess and needs only 4 checks.

💡 need a hint?

srch-fewest-guesses.py🔒 given lines are locked — write your code in between
loading...