Pattern
Binary Search
A compact view of archive entries grouped by recurring technique.
80 entries
80 entries tagged as Binary Search.
13.03.2026
medium3296. Minimum Number of Seconds to Make Mountain Height Zero
Min steps to work a mountain with arithmetic-sum-workers
12.03.2026
hard3600. Maximize Spanning Tree Stability with Upgrades
Max of min values in span tree of graph, 2 s at most k
09.02.2026
medium1382. Balance a Binary Search Tree
Balance binary search tree
31.01.2026
easy744. Find Smallest Letter Greater Than Target
Larger letter in array
13.01.2026
medium3453. Separate Squares I
Min Y to split into equal areas
28.12.2025
easy1351. Count Negative Numbers in a Sorted Matrix
Count negatives in 2D sorted matrix
23.12.2025
medium2054. Two Best Non-Overlapping Events
Max at most two non-overlapping events max
07.11.2025
hard2528. Maximize the Minimum Powered City
Max min r-range sum after adding total of k window
09.10.2025
medium3494. Find the Minimum Amount of Time to Brew Potions
Min total time to finish all skills[i] mana[j], non-intersecting
08.10.2025
medium2300. Successful Pairs of Spells and Potions
Number of potions spells[i] bigger than success
07.10.2025
medium1488. Avoid Flood in The City
Replace zeros with numbers to avoid duplicates search
26.09.2025
medium611. Valid Triangle Number
Count triangles can be made from numbers search sum
8.07.2025
hard1751. Maximum Number of Events That Can Be Attended II
Max top k valued intervals search
29.06.2025
medium1498. Number of Subsequences That Satisfy the Given Sum Condition
Subsequencies target in 0..min+max search pointers
25.06.2025
hard2040. Kth Smallest Product of Two Sorted Arrays
K-th increasing product from two arrays search
13.06.2025
medium2616. Minimize the Maximum Difference of Pairs
Min max diffs non-overlapped pairs search
01.05.2025
hard2071. Maximum Number of Tasks You Can Assign
Tasks can be done by workers with pills search
16.03.2025
medium2594. Minimum Time to Repair Cars
Min rank[i] count^2 to fix all cars search
15.03.2025
medium2560. House Robber IV
Min-max of non-adjucents in array search
14.03.2025
medium2226. Maximum Candies Allocated to K Children
Distribute candies to k equal buckets search
13.03.2025
medium3356. Zero Array Transformation II
Min queries (l..r, v) to decrease nums by v to 0 sweep
12.03.2025
easy2529. Maximum Count of Positive Integer and Negative Integer
Max positive count or negative count search
22.12.2024
hard2940. Find Building Where Alice and Bob Can Meet
Common indices t, h[t] > h[a], h[t] > h[b] for queries q[][a,b] stack
11.12.2024
medium2779. Maximum Beauty of an Array After Applying Operation
Max equal nums after adjusting to [-k..+k] search sweep
10.12.2024
medium2981. Find Longest Special Substring That Occurs Thrice I
Max same-char 3-windows length window
08.12.2024
medium2054. Two Best Non-Overlapping Events
Max two non-overlapping intervals search
07.12.2024
medium1760. Minimum Limit of Balls in a Bag
Max number after at most maxOperations of splitting search
06.12.2024
medium2554. Maximum Number of Integers to Choose From a Range I
Sum 1..n excluding banned until maxSum
01.12.2024
easy1346. Check If N and Its Double Exist
Any i != j && a[i] = 2 a[j]
14.11.2024
medium2064. Minimized Maximum of Products Distributed to Any Store
Min of max of quantities spread by n single-type stores search
13.11.2024
medium2563. Count the Number of Fair Pairs
Count pairs a[i] + a[j] in lower..upper search pointers
12.11.2024
medium2070. Most Beautiful Item for Each Query
Queries of max beauty for q[i] price search
11.11.2024
medium2601. Prime Subtraction Operation
Increased sequence by subtracting primes? search
30.10.2024
hard1671. Minimum Number of Removals to Make Mountain Array
Min removes to make a mountain programming search
27.09.2024
medium731. My Calendar II
Add intervals intersecting less than two times sweep
26.09.2024
medium729. My Calendar I
Insert non-intersection interval search
02.09.2024
medium1894. Find the Student that Will Replace the Chalk
Position of a k sum in a cyclic array
14.08.2024
hard719. Find K-th Smallest Pair Distance
kth smallest pairs diff in an array search pointers
04.08.2024
medium1508. Range Sum of Sorted Subarray Sums
Sum of [left..right] of sorted subarray's sums
26.06.2024
medium1382. Balance a Binary Search Tree
Make a balanced Binary Search Tree
25.06.2024
medium1038. Binary Search Tree to Greater Sum Tree
Aggregate Binary Search Tree from the right
20.06.2024
medium1552. Magnetic Force Between Two Balls
Max shortest distance between m positions search
19.06.2024
medium1482. Minimum Number of Days to Make m Bouquets
Min days to take m k-subarrays search
17.06.2024
medium633. Sum of Square Numbers
Is c sum of squares? search
10.05.2024
medium786. K-th Smallest Prime Fraction
kth arr[i]/arr[j], i < j, arr[i] < arr[j] search
17.03.2024
medium57. Insert Interval
Insert interval into a sorted intervals array
13.03.2024
easy2485. Find the Pivot Integer
Pivot of 1..n where sum[1..p] == sum[p..n].
6.01.2024
hard1235. Maximum Profit in Job Scheduling
Max profit in non-intersecting jobs given startTime[], endTime[] and profit[].
5.01.2024
medium300. Longest Increasing Subsequence
Longest increasing subsequence length.
01.11.2023
easy501. Find Mode in Binary Search Tree
Most frequent elements in a Binary Search Tree
29.10.2023
hard458. Poor Pigs
Minimum pigs to find a poison in buckets in k rounds
12.10.2023
hard1095. Find in Mountain Array
Binary Search in a mountain
11.10.2023
hard2251. Number of Flowers in Full Bloom
Array of counts of segments in intersection
10.10.2023
hard2009. Minimum Number of Operations to Make Array Continuous
Min replacements to make array continuous a[i] = a[i - 1] + 1
9.10.2023
medium34. Find First and Last Position of Element in Sorted Array
Binary Search range
21.09.2023
hard4. Median of Two Sorted Arrays
Median in two concatenated sorted arrays
27.08.2023
hard403. Frog Jump
Can jump an array when each jump is k-1..k+1 of the previous
10.08.2023
medium81. Search in Rotated Sorted Array II
Binary Search in a rotated array with duplicates
09.08.2023
medium2616. Minimize the Maximum Difference of Pairs
Minimum of maximums possible p diffs of distinct array positions
08.08.2023
medium33. Search in Rotated Sorted Array
Binary Search in a shifted array
07.08.2023
medium74. Search a 2D Matrix
D Binary Search
05.08.2023
medium95. Unique Binary Search Trees II
All possible Binary Search Trees for 1..n numbers
27.07.2023
hard2141. Maximum Running Time of N Computers
Maximum time to use n batteries in parallel
26.07.2023
medium1870. Minimum Speed to Arrive on Time
Max speed for all dist departing at round hours, be fit in hour
25.07.2023
medium852. Peak Index in a Mountain Array
Mountain pattern index in the array in log time
30.06.2023
hard1970. Last Day Where You Can Still Cross
Last day matrix connected top-bottom when flooded each day at cells[day]
21.06.2023
hard2448. Minimum Cost to Make Array Equal
Min cost to make all arr[i] equal, where each change is cost[i]
16.06.2023
hard1569. Number of Ways to Reorder Array to Get Same BST
Count permutations of an array with identical Binary Search Tree
11.06.2023
medium1146. Snapshot Array
Implement an array where all elements can be saved into a `snapshot's.
09.06.2023
easy744. Find Smallest Letter Greater Than Target
Lowest char greater than target.
05.04.2023
medium2439. Minimize Maximum of Array
careful with integers overflows
01.04.2023
easy704. Binary Search
For more robust code
11.03.2023
medium109. Convert Sorted List to Binary Search Tree
Compute the middle of the linked list.
08.03.2023
medium875. Koko Eating Bananas
For more robust binary search
07.03.2023
medium2187. Minimum Time to Complete Trips
Do a binary search. For the hi value, we can peak a $$10^7$$ or just compute all the time it takes for every bus to trip.
06.03.2023
easy1539. Kth Missing Positive Number
For more robust binary search code
22.02.2023
medium1011. Capacity To Ship Packages Within D Days
To more robust binary search code
21.02.2023
medium540. Single Element in a Sorted Array
Let's write a binary search. For more robust code, consider
20.02.2023
easy35. Search Insert Position
For more robust code consider
17.02.2023
easy783. Minimum Distance Between BST Nodes
Let's write Morris Traversal. Store current node at the rightmost end of the left children.