Files
freecodecamp--freecodecamp/curriculum/challenges/english/blocks/algorithms-in-code/binary-search-in-code-video.md
T
wehub-resource-sync dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 11:55:53 +08:00

657 B

id, title, challengeType, videoId, dashedName
id title challengeType videoId dashedName
698dcc2c7932b3cc4b19c927 Binary Search in Code 11 mg7F5D8Wk5o binary-search-in-code

--description--

In this video, you will code out the binary search algorithm using Python.

--questions--

--text--

Why was the while first <= last: condition used in the solution?

--answers--

To ensure only the first half of the array is ever checked.


To make the loop run forever until manually stopped.


To skip checking the last element in the search range.


To keep searching while there are still elements in the range and stop when the range is empty.

--video-solution--

4