← back

Binary Search

283 questions · 0 seen

All Binary Search problems

Problems

4 Median of Two Sorted Arrays
33 Search in Rotated Sorted Array
34 Find First and Last Position of Element in Sorted Array
35 Search Insert Position
69 Sqrt(x)
74 Search a 2D Matrix
81 Search in Rotated Sorted Array II
153 Find Minimum in Rotated Sorted Array
154 Find Minimum in Rotated Sorted Array II
162 Find Peak Element
167 Two Sum II - Input Array Is Sorted
209 Minimum Size Subarray Sum
222 Count Complete Tree Nodes
240 Search a 2D Matrix II
268 Missing Number
275 H-Index II
278 First Bad Version
287 Find the Duplicate Number
300 Longest Increasing Subsequence
315 Count of Smaller Numbers After Self
327 Count of Range Sum
349 Intersection of Two Arrays
350 Intersection of Two Arrays II
352 Data Stream as Disjoint Intervals
354 Russian Doll Envelopes
363 Max Sum of Rectangle No Larger Than K
367 Valid Perfect Square
374 Guess Number Higher or Lower
378 Kth Smallest Element in a Sorted Matrix
400 Nth Digit
410 Split Array Largest Sum
436 Find Right Interval
441 Arranging Coins
456 132 Pattern
475 Heaters
483 Smallest Good Base
493 Reverse Pairs
497 Random Point in Non-overlapping Rectangles
528 Random Pick with Weight
532 K-diff Pairs in an Array
540 Single Element in a Sorted Array
611 Valid Triangle Number
633 Sum of Square Numbers
658 Find K Closest Elements
668 Kth Smallest Number in Multiplication Table
704 Binary Search
710 Random Pick with Blacklist (PRO)
713 Subarray Product Less Than K
718 Maximum Length of Repeated Subarray
719 Find K-th Smallest Pair Distance
729 My Calendar I
731 My Calendar II
732 My Calendar III
744 Find Smallest Letter Greater Than Target
754 Reach a Number
778 Swim in Rising Water
786 K-th Smallest Prime Fraction
792 Number of Matching Subsequences
793 Preimage Size of Factorial Zeroes Function
825 Friends Of Appropriate Ages
826 Most Profit Assigning Work
852 Peak Index in a Mountain Array
862 Shortest Subarray with Sum at Least K
875 Koko Eating Bananas
878 Nth Magical Number
887 Super Egg Drop
888 Fair Candy Swap
902 Numbers At Most N Given Digit Set
911 Online Election
981 Time Based Key-Value Store
1004 Max Consecutive Ones III
1011 Capacity To Ship Packages Within D Days
1027 Longest Arithmetic Subsequence
1044 Longest Duplicate Substring
1095 Find in Mountain Array
1146 Snapshot Array
1157 Online Majority Element In Subarray
1170 Compare Strings by Frequency of the Smallest Character
1187 Make Array Strictly Increasing
1201 Ugly Number III
1208 Get Equal Substrings Within Budget
1235 Maximum Profit in Job Scheduling
1237 Find Positive Integer Solution for a Given Equation
1268 Search Suggestions System
1283 Find the Smallest Divisor Given a Threshold
1292 Maximum Side Length of a Square with Sum Less than or Equal to Threshold
1300 Sum of Mutated Array Closest to Target
1337 The K Weakest Rows in a Matrix
1346 Check If N and Its Double Exist
1348 Tweet Counts Per Frequency
1351 Count Negative Numbers in a Sorted Matrix
1385 Find the Distance Value Between Two Arrays
1439 Find the Kth Smallest Sum of a Matrix With Sorted Rows
1477 Find Two Non-overlapping Sub-arrays Each With Target Sum
1482 Minimum Number of Days to Make m Bouquets
1483 Kth Ancestor of a Tree Node
1488 Avoid Flood in The City
1498 Number of Subsequences That Satisfy the Given Sum Condition
1508 Range Sum of Sorted Subarray Sums
1521 Find a Value of a Mysterious Function Closest to Target
1539 Kth Missing Positive Number
1552 Magnetic Force Between Two Balls
1562 Find Latest Group of Size M
1574 Shortest Subarray to be Removed to Make Array Sorted
1608 Special Array With X Elements Greater Than or Equal X
1631 Path With Minimum Effort
1648 Sell Diminishing-Valued Colored Balls
1649 Create Sorted Array through Instructions (PRO)
1658 Minimum Operations to Reduce X to Zero
1671 Minimum Number of Removals to Make Mountain Array
1712 Ways to Split Array Into Three Subarrays
1713 Minimum Operations to Make a Subsequence
1739 Building Boxes
1751 Maximum Number of Events That Can Be Attended II
1760 Minimum Limit of Balls in a Bag
1782 Count Pairs Of Nodes
1793 Maximum Score of a Good Subarray
1802 Maximum Value at a Given Index in a Bounded Array
1818 Minimum Absolute Sum Difference
1838 Frequency of the Most Frequent Element
1847 Closest Room
1851 Minimum Interval to Include Each Query (PRO)
1855 Maximum Distance Between a Pair of Values
1862 Sum of Floored Pairs
1870 Minimum Speed to Arrive on Time
1889 Minimum Space Wasted From Packaging
1894 Find the Student that Will Replace the Chalk
1898 Maximum Number of Removable Characters
1901 Find a Peak Element II
1923 Longest Common Subpath (PRO)
1954 Minimum Garden Perimeter to Collect Enough Apples
1964 Find the Longest Valid Obstacle Course at Each Position
1970 Last Day Where You Can Still Cross (PRO)
2008 Maximum Earnings From Taxi
2009 Minimum Number of Operations to Make Array Continuous
2024 Maximize the Confusion of an Exam
2035 Partition Array Into Two Arrays to Minimize Sum Difference
2040 Kth Smallest Product of Two Sorted Arrays
2054 Two Best Non-Overlapping Events
2055 Plates Between Candles
2064 Minimized Maximum of Products Distributed to Any Store
2070 Most Beautiful Item for Each Query
2071 Maximum Number of Tasks You Can Assign
2080 Range Frequency Queries
2089 Find Target Indices After Sorting Array
2106 Maximum Fruits Harvested After at Most K Steps
2111 Minimum Operations to Make the Array K-Increasing
2141 Maximum Running Time of N Computers
2179 Count Good Triplets in an Array
2187 Minimum Time to Complete Trips
2223 Sum of Scores of Built Strings
2226 Maximum Candies Allocated to K Children
2234 Maximum Total Beauty of the Gardens
2250 Count Number of Rectangles Containing Each Point
2251 Number of Flowers in Full Bloom
2258 Escape the Spreading Fire
2271 Maximum White Tiles Covered by a Carpet
2286 Booking Concert Tickets in Groups
2300 Successful Pairs of Spells and Potions
2302 Count Subarrays With Score Less Than K
2332 The Latest Time to Catch a Bus
2333 Minimum Sum of Squared Difference
2354 Number of Excellent Pairs
2358 Maximum Number of Groups Entering a Competition
2389 Longest Subsequence With Limited Sum
2398 Maximum Number of Robots Within Budget
2411 Smallest Subarrays With Maximum Bitwise OR
2424 Longest Uploaded Prefix
2426 Number of Pairs Satisfying Inequality
2439 Minimize Maximum of Array
2448 Minimum Cost to Make Array Equal
2454 Next Greater Element IV
2476 Closest Nodes Queries in a Binary Search Tree
2498 Frog Jump II
2501 Longest Square Streak in an Array
2513 Minimize the Maximum of Two Arrays
2517 Maximum Tastiness of Candy Basket
2528 Maximize the Minimum Powered City
2529 Maximum Count of Positive Integer and Negative Integer
2540 Minimum Common Value
2554 Maximum Number of Integers to Choose From a Range I
2555 Maximize Win From Two Segments
2560 House Robber IV
2563 Count the Number of Fair Pairs
2565 Subsequence With the Minimum Score
2576 Find the Maximum Number of Marked Indices
2589 Minimum Time to Complete All Tasks
2594 Minimum Time to Repair Cars
2601 Prime Subtraction Operation
2602 Minimum Operations to Make All Array Elements Equal
2616 Minimize the Maximum Difference of Pairs
2659 Make Array Empty
2713 Maximum Strictly Increasing Cells in a Matrix
2736 Maximum Sum Queries
2779 Maximum Beauty of an Array After Applying Operation
2790 Maximum Number of Groups With Increasing Length
2812 Find the Safest Path in a Grid
2817 Minimum Absolute Difference Between Elements With Constraint
2824 Count Pairs Whose Sum is Less than Target
2826 Sorting Three Groups
2830 Maximize the Profit as the Salesman
2831 Find the Longest Equal Subarray
2856 Minimum Array Length After Pair Removals
2861 Maximum Number of Alloys
2926 Maximum Balanced Subsequence Sum
2940 Find Building Where Alice and Bob Can Meet
2945 Find Maximum Non-decreasing Array Length
2967 Minimum Cost to Make Array Equalindromic
2968 Apply Operations to Maximize Frequency Score
2970 Count the Number of Incremovable Subarrays I
2972 Count the Number of Incremovable Subarrays II
2981 Find Longest Special Substring That Occurs Thrice I
2982 Find Longest Special Substring That Occurs Thrice II
3006 Find Beautiful Indices in the Given Array I
3007 Maximum Number That Sum of the Prices Is Less Than or Equal to K
3008 Find Beautiful Indices in the Given Array II
3048 Earliest Second to Mark Indices I
3049 Earliest Second to Mark Indices II
3113 Find the Number of Subarrays Where Boundary Elements Are Maximum
3116 Kth Smallest Amount With Single Denomination Combination
3117 Minimum Sum of Values by Dividing Array
3134 Find the Median of the Uniqueness Array
3143 Maximum Points Inside the Square
3145 Find Products of Elements of Big Array
3152 Special Array II
3161 Block Placement Queries
3171 Find Subarray With Bitwise OR Closest to K
3186 Maximum Total Damage With Spell Casting
3209 Number of Subarrays With AND Value of K
3261 Count Substrings That Satisfy K-Constraint II
3281 Maximize Score of Numbers in Ranges
3288 Length of the Longest Increasing Path
3291 Minimum Number of Valid Strings to Form Target I
3292 Minimum Number of Valid Strings to Form Target II
3296 Minimum Number of Seconds to Make Mountain Height Zero
3312 Sorted GCD Pair Queries (PRO)
3346 Maximum Frequency of an Element After Performing Operations I
3347 Maximum Frequency of an Element After Performing Operations II
3350 Adjacent Increasing Subarrays Detection II
3356 Zero Array Transformation II
3357 Minimize the Maximum Adjacent Element Difference
3398 Smallest Substring With Identical Characters I
3399 Smallest Substring With Identical Characters II
3413 Maximum Coins From K Consecutive Bags
3414 Maximum Score of Non-overlapping Intervals
3419 Minimize the Maximum Edge Weight of Graph
3449 Maximize the Minimum Game Score (PRO)
3453 Separate Squares I
3454 Separate Squares II
3455 Shortest Matching Substring
3464 Maximize the Distance Between Points on a Square
3477 Fruits Into Baskets II
3479 Fruits Into Baskets III
3488 Closest Equal Element Queries
3501 Maximize Active Section with Trade II
3508 Implement Router
3532 Path Existence Queries in a Graph I
3534 Path Existence Queries in a Graph II
3585 Find Weighted Median Node in Tree
3600 Maximize Spanning Tree Stability with Upgrades
3605 Minimum Stability Factor of Array
3608 Minimum Time for K Connected Components
3613 Minimize Maximum Component Cost
3620 Network Recovery Pathways
3633 Earliest Finish Time for Land and Water Rides I
3634 Minimum Removals to Balance Array
3635 Earliest Finish Time for Land and Water Rides II
3636 Threshold Majority Queries
3639 Minimum Time to Activate String
3661 Maximum Walls Destroyed by Robots
3709 Design Exam Scores Tracker
3710 Maximum Partition Factor
3722 Lexicographically Smallest String After Reverse
3733 Minimum Time to Complete All Deliveries
3748 Count Stable Subarrays
3759 Count Elements With at Least K Greater Values
3762 Minimum Operations to Equalize Subarrays
3766 Minimum Operations to Make Binary Palindrome
3771 Total Score of Dungeon Runs
3801 Minimum Cost to Merge Sorted Lists
3814 Maximum Capacity Within Budget
3824 Minimum K to Reduce Array Within Limit
3825 Longest Strictly Increasing Subsequence With Non-Zero Bitwise AND