Files
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

38 lines
657 B
Markdown

---
id: 698dcc2c7932b3cc4b19c927
title: Binary Search in Code
challengeType: 11
videoId: mg7F5D8Wk5o
dashedName: 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