Binary search
- Stage
- 5
- Module
- M5.5
- Lessons
- 1
In this module
- Use bisect_left and bisect_right to find insertion points in sorted arrays.
- Implement binary search on the answer over a monotone predicate.
- Maintain correct loop invariants and avoid off-by-one errors.
Before this module
Lessons
Practice
Try this on the judge. The link opens the problem on WMOJ.
- 2021 S3Lunch Concert (opens on WMOJ in a new tab) WMOJ
Find the concert with the best time match using binary search on sorted data.