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