Search in Rotated Array
Implement an efficient search in a rotated sorted array using modified binary search.
Search Insert Position
Return the index where a target should be inserted into a sorted list to maintain order.
Find Minimum in Rotated Sorted Array
Implement a function that finds the minimum element in a rotated sorted array of distinct integers in O(log n) time.
Koko Eating Bananas
Given piles of bananas and hours, find the minimum integer eating speed Koko needs to finish all piles within H hours.
Capacity to Ship Packages
Given package weights and days allowed, compute the smallest ship capacity that can deliver all packages in order within the given days.
Median of Sorted Array BS
Implement a binary search algorithm to find the median of two sorted arrays efficiently.
Kth Missing Positive
Given a strictly increasing array and an integer k, return the k-th positive integer that is missing from the array.
Binary Search on Answer: Find the Minimal Maximum Subarray Sum
Implement a function that finds the minimal possible maximum subarray sum when splitting an array into at most k contiguous subarrays.
Lower Bound Binary Search
Implement binary search to find the first index where an element is not less than a given target.
Upper Bound Binary Search
Write a function that returns the index of the first element greater than a target in a sorted list.
Kth Smallest in Sorted Matrix
Implement kth_smallest(matrix, k) to return the kth smallest element in a row- and column-sorted square matrix.
Book Allocation: Minimize Maximum Pages
Implement a function that returns the minimized maximum pages when allocating a list of books to k students.
Minimum Limit of Balls in a Bag
Given an array of bag sizes and a number of allowed splits, find the minimum possible maximum bag size.
Showing 1–13 of 13 challenges · Binary Search
Binary Search — Python coding challenges
What you will find here
This page lists binary search challenges — real Python problems you solve in the browser IDE with instant test feedback. Each challenge includes a clear brief, starter code, and automated checks.
Challenges vs tutorials and quizzes
Challenges test what you can build under constraints. For guided teaching, use our Python tutorials. For quick checks, try quizzes or copy snippets from code samples.