Binary Search | LeetCode Problems

117 Binary Search solutions to LeetCode solutions.

Binary Search Problems View all solutions →

Median of Two Sorted Arrays

#4 Hard

Search in Rotated Sorted Array

#33 Medium

Find First and Last Position of Element in Sorted Array

#34 Medium

Search Insert Position

#35 Easy

Sqrt(x)

#69 Medium

Search a 2D Matrix

#74 Medium

Search in Rotated Sorted Array II

#81 Medium

Find Minimum in Rotated Sorted Array

#153 Medium

Find Minimum in Rotated Sorted Array II

#154 Hard

Find Peak Element

#162 Medium

Two Sum II - Input Array Is Sorted

#167 Easy

Minimum Size Subarray Sum

#209 Medium

Count Complete Tree Nodes

#222 Easy

Search a 2D Matrix II

#240 Medium

Missing Number

#268 Easy

H-Index II

#275 Medium

First Bad Version

#278 Medium

Find the Duplicate Number

#287 Medium

Longest Increasing Subsequence

#300 Medium

Count of Smaller Numbers After Self

#315 Hard

Count of Range Sum

#327 Hard

Intersection of Two Arrays

#349 Easy

Intersection of Two Arrays II

#350 Easy

Data Stream as Disjoint Intervals

#352 Hard

Russian Doll Envelopes

#354 Hard

Max Sum of Rectangle No Larger Than K

#363 Hard

Valid Perfect Square

#367 Easy

Guess Number Higher or Lower

#374 Medium

Kth Smallest Element in a Sorted Matrix

#378 Medium

Nth Digit

#400 Medium

Split Array Largest Sum

#410 Hard

Find Right Interval

#436 Medium

Arranging Coins

#441 Easy

132 Pattern

#456 Medium

Heaters

#475 Medium

Smallest Good Base

#483 Hard

Reverse Pairs

#493 Hard

Random Point in Non-overlapping Rectangles

#497 Medium

Random Pick with Weight

#528 Medium

K-diff Pairs in an Array

#532 Medium

Single Element in a Sorted Array

#540 Medium

Valid Triangle Number

#611 Medium

Sum of Square Numbers

#633 Medium

Find K Closest Elements

#658 Medium

Kth Smallest Number in Multiplication Table

#668 Hard

Binary Search

#704 Easy

Random Pick with Blacklist

#710 Hard

Subarray Product Less Than K

#713 Medium

Maximum Length of Repeated Subarray

#718 Medium

Find K-th Smallest Pair Distance

#719 Hard

My Calendar I

#729 Medium

My Calendar II

#731 Medium

My Calendar III

#732 Hard

Find Smallest Letter Greater Than Target

#744 Easy

Reach a Number

#754 Medium

Swim in Rising Water

#778 Hard

K-th Smallest Prime Fraction

#786 Medium

Number of Matching Subsequences

#792 Medium

Preimage Size of Factorial Zeroes Function

#793 Hard

Friends Of Appropriate Ages

#825 Medium

Most Profit Assigning Work

#826 Medium

Peak Index in a Mountain Array

#852 Medium

Shortest Subarray with Sum at Least K

#862 Hard

Koko Eating Bananas

#875 Medium

Nth Magical Number

#878 Hard

Super Egg Drop

#887 Hard

Fair Candy Swap

#888 Easy

Numbers At Most N Given Digit Set

#902 Hard

Online Election

#911 Medium

Time Based Key-Value Store

#981 Medium

Max Consecutive Ones III

#1004 Medium

Capacity To Ship Packages Within D Days

#1011 Medium

Longest Arithmetic Subsequence

#1027 Medium

Longest Duplicate Substring

#1044 Hard

Find in Mountain Array

#1095 Hard

Snapshot Array

#1146 Medium

Online Majority Element In Subarray

#1157 Hard

Compare Strings by Frequency of the Smallest Character

#1170 Medium

Make Array Strictly Increasing

#1187 Hard

Ugly Number III

#1201 Medium

Get Equal Substrings Within Budget

#1208 Medium

Maximum Profit in Job Scheduling

#1235 Hard

Find Positive Integer Solution for a Given Equation

#1237 Medium

Search Suggestions System

#1268 Medium

Find the Smallest Divisor Given a Threshold

#1283 Medium

Maximum Side Length of a Square with Sum Less than or Equal to Threshold

#1292 Medium

Sum of Mutated Array Closest to Target

#1300 Medium

The K Weakest Rows in a Matrix

#1337 Easy

Check If N and Its Double Exist

#1346 Easy

Tweet Counts Per Frequency

#1348 Medium

Count Negative Numbers in a Sorted Matrix

#1351 Easy

Find the Distance Value Between Two Arrays

#1385 Easy

Find the Kth Smallest Sum of a Matrix With Sorted Rows

#1439 Hard

Find Two Non-overlapping Sub-arrays Each With Target Sum

#1477 Medium

Minimum Number of Days to Make m Bouquets

#1482 Medium

Kth Ancestor of a Tree Node

#1483 Hard

Avoid Flood in The City

#1488 Medium

Number of Subsequences That Satisfy the Given Sum Condition

#1498 Medium

Range Sum of Sorted Subarray Sums

#1508 Medium

Find a Value of a Mysterious Function Closest to Target

#1521 Hard

Kth Missing Positive Number

#1539 Easy

Magnetic Force Between Two Balls

#1552 Medium

Find Latest Group of Size M

#1562 Medium

Shortest Subarray to be Removed to Make Array Sorted

#1574 Medium

Special Array With X Elements Greater Than or Equal X

#1608 Easy

Path With Minimum Effort

#1631 Medium

Sell Diminishing-Valued Colored Balls

#1648 Medium

Create Sorted Array through Instructions

#1649 Hard

Count Good Triplets in an Array

#2179 Hard

Maximum Candies Allocated to K Children

#2226 Medium

Successful Pairs of Spells and Potions

#2300 Medium

Maximum Count of Positive Integer and Negative Integer

#2529 Easy

House Robber IV

#2560 Medium

Count the Number of Fair Pairs

#2563 Medium

Minimum Time to Repair Cars

#2594 Medium

Zero Array Transformation II

#3356 Medium

Maximize the Distance Between Points on a Square

#3464 Hard