Binary Search Interview Questions

Search on sorted ranges and answer-space binary search.

137 problems

#Title
4Median of Two Sorted Arrays
33Search in Rotated Sorted Array
34Find First and Last Position of Element in Sorted Array
35Search Insert Position
69Sqrt(x)
74Search a 2D Matrix
81Search in Rotated Sorted Array II
153Find Minimum in Rotated Sorted Array
154Find Minimum in Rotated Sorted Array II
162Find Peak Element
222Count Complete Tree Nodes
275H-Index II
278First Bad Version
300Longest Increasing Subsequence
302Smallest Rectangle Enclosing Black Pixels
354Russian Doll Envelopes
363Max Sum of Rectangle No Larger Than K
367Valid Perfect Square
374Guess Number Higher or Lower
410Split Array Largest Sum
436Find Right Interval
475Heaters
540Single Element in a Sorted Array
658Find K Closest Elements
668Kth Smallest Number in Multiplication Table
702Search in a Sorted Array of Unknown Size
704Binary Search
710Random Pick with Blacklist
719Find K-th Smallest Pair Distance
744Find Smallest Letter Greater Than Target
774Minimize Max Distance to Gas Station
786K-th Smallest Prime Fraction
793Preimage Size of Factorial Zeroes Function
852Peak Index in a Mountain Array
875Koko Eating Bananas
878Nth Magical Number
894All Possible Full Binary Trees
911Online Election
981Time Based Key-Value Store
1011Capacity To Ship Packages Within D Days
1044Longest Duplicate Substring
1060Missing Element in Sorted Array
1062Longest Repeating Substring
1064Fixed Point
1095Find in Mountain Array
1110Delete Nodes And Return Forest
1170Compare Strings by Frequency of the Smallest Character
1201Ugly Number III
1228Missing Number In Arithmetic Progression
1231Divide Chocolate
1274Number of Ships in a Rectangle
1283Find the Smallest Divisor Given a Threshold
1287Element Appearing More Than 25% In Sorted Array
1385Find the Distance Value Between Two Arrays
1482Minimum Number of Days to Make m Bouquets
1533Find the Index of the Large Integer
1539Kth Missing Positive Number
1552Magnetic Force Between Two Balls
1618Maximum Font to Fit a Sentence in a Screen
1648Sell Diminishing-Valued Colored Balls
1671Minimum Number of Removals to Make Mountain Array
1713Minimum Operations to Make a Subsequence
1760Minimum Limit of Balls in a Bag
1802Maximum Value at a Given Index in a Bounded Array
1818Minimum Absolute Sum Difference
1870Minimum Speed to Arrive on Time
1889Minimum Space Wasted From Packaging
1891Cutting Ribbons
1898Maximum Number of Removable Characters
1901Find a Peak Element II
1918Kth Smallest Subarray Sum
1964Find the Longest Valid Obstacle Course at Each Position
2064Minimized Maximum of Products Distributed to Any Store
2111Minimum Operations to Make the Array K-Increasing
2137Pour Water Between Buckets to Make Water Levels Equal
2187Minimum Time to Complete Trips
2226Maximum Candies Allocated to K Children
2250Count Number of Rectangles Containing Each Point
2300Successful Pairs of Spells and Potions
2333Minimum Sum of Squared Difference
2387Median of a Row Wise Sorted Matrix
2389Longest Subsequence With Limited Sum
2448Minimum Cost to Make Array Equal
2476Closest Nodes Queries in a Binary Search Tree
2513Minimize the Maximum of Two Arrays
2517Maximum Tastiness of Candy Basket
2528Maximize the Minimum Powered City
2529Maximum Count of Positive Integer and Negative Integer
2554Maximum Number of Integers to Choose From a Range I
2557Maximum Number of Integers to Choose From a Range II
2560House Robber IV
2594Minimum Time to Repair Cars
2602Minimum Operations to Make All Array Elements Equal
2616Minimize the Maximum Difference of Pairs
2702Minimum Operations to Make Numbers Non-positive
2936Number of Equal Numbers Blocks
2940Find Building Where Alice and Bob Can Meet
3048Earliest Second to Mark Indices I
3049Earliest Second to Mark Indices II
3104Find Longest Self-Contained Substring
3116Kth Smallest Amount With Single Denomination Combination
3134Find the Median of the Uniqueness Array
3135Equalize Strings by Adding or Removing Characters at Ends
3145Find Products of Elements of Big Array
3231Minimum Number of Increasing Subsequence to Be Removed
3233Find the Count of Numbers Which Are Not Special
3281Maximize Score of Numbers in Ranges
3288Length of the Longest Increasing Path
3296Minimum Number of Seconds to Make Mountain Height Zero
3356Zero Array Transformation II
3357Minimize the Maximum Adjacent Element Difference
3398Smallest Substring With Identical Characters I
3399Smallest Substring With Identical Characters II
3449Maximize the Minimum Game Score
3464Maximize the Distance Between Points on a Square
3477Fruits Into Baskets II
3479Fruits Into Baskets III
3520Minimum Threshold for Inversion Pairs Count
3605Minimum Stability Factor of Array
3722Lexicographically Smallest String After Reverse
3733Minimum Time to Complete All Deliveries
3735Lexicographically Smallest String After Reverse II
3771Total Score of Dungeon Runs
3807Minimum Cost to Repair Edges to Traverse a Graph
3824Minimum K to Reduce Array Within Limit
3825Longest Strictly Increasing Subsequence With Non-Zero Bitwise AND
3826Minimum Partition Score
3893Maximum Team Size with Overlapping Intervals
3911K-th Smallest Remaining Even Integer in Subarray Queries
3920Maximize Fixed Points After Deletions
3924Minimum Threshold Path With Limited Heavy Edges
3929Minimum Partition Score II
3932Count K-th Roots in a Range
3934Smallest Unique Subarray
3956Maximum Sum of M Non-Overlapping Subarrays I
3957Maximum Sum of M Non-Overlapping Subarrays II
3971Maximum Total Value