Binary Search Problems
Master binary search problems with AI-powered solutions. Get instant coding assistance during your technical interviews for all 201 problems in this category.
Total Problems: 201
Easy: 24
Medium: 113
Hard: 64
Showing 50 of 201 problems
Problems
Scroll within this area to browse all problems
#
Title
Difficulty
Binary Search LeetCode Problems List
- 4. Median of Two Sorted Arrays - Hard - Binary SearchGiven two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays. The overall run time complexity shou... Topics: Array, Binary Search, Divide and Conquer
- 792. Binary Search - Easy - Binary SearchGiven an array of integers nums which is sorted in ascending order, and an integer target, write a function to search target in nums. If target exists... Topics: Array, Binary Search
- 300. Longest Increasing Subsequence - Medium - Binary SearchGiven an integer array nums, return the length of the longest strictly increasing subsequence.... Topics: Array, Binary Search, Dynamic Programming
- 374. Guess Number Higher or Lower - Easy - Binary SearchWe are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You have to guess which number I picked (the number I picked stays... Topics: Binary Search, Interactive
- 162. Find Peak Element - Medium - Binary SearchA peak element is an element that is strictly greater than its neighbors. Given a 0-indexed integer array nums, find a peak element, and return its in... Topics: Array, Binary Search
- 268. Missing Number - Easy - Binary SearchGiven an array nums containing n distinct numbers in the range [0, n], return the only number in the range that is missing from the array.... Topics: Array, Hash Table, Math, Binary Search, Bit Manipulation, Sorting
- 378. Kth Smallest Element in a Sorted Matrix - Medium - Binary SearchGiven an n x n matrix where each of the rows and columns is sorted in ascending order, return the kth smallest element in the matrix. Note that it is ... Topics: Array, Binary Search, Sorting, Heap (Priority Queue), Matrix
- 167. Two Sum II - Input Array Is Sorted - Medium - Binary SearchGiven a 1-indexed array of integers numbers that is already sorted in non-decreasing order, find two numbers such that they add up to a specific targe... Topics: Array, Two Pointers, Binary Search
- 33. Search in Rotated Sorted Array - Medium - Binary SearchThere is an integer array nums sorted in ascending order (with distinct values). Prior to being passed to your function, nums is possibly left rotated... Topics: Array, Binary Search
- 222. Count Complete Tree Nodes - Easy - Binary SearchGiven the root of a complete binary tree, return the number of the nodes in the tree. According to Wikipedia, every level, except possibly the last, i... Topics: Binary Search, Bit Manipulation, Tree, Binary Tree
- 1046. Max Consecutive Ones III - Medium - Binary SearchGiven a binary array nums and an integer k, return the maximum number of consecutive 1's in the array if you can flip at most k 0's.... Topics: Array, Binary Search, Sliding Window, Prefix Sum
- 153. Find Minimum in Rotated Sorted Array - Medium - Binary SearchSuppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,2,4,5,6,7] might become: [... Topics: Array, Binary Search
- 34. Find First and Last Position of Element in Sorted Array - Medium - Binary SearchGiven an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value. If target is not found ... Topics: Array, Binary Search
- 69. Sqrt(x) - Easy - Binary SearchGiven a non-negative integer x, return the square root of x rounded down to the nearest integer. The returned integer should be non-negative as well. ... Topics: Math, Binary Search
- 315. Count of Smaller Numbers After Self - Hard - Binary SearchGiven an integer array nums, return an integer array counts where counts[i] is the number of smaller elements to the right of nums[i].... Topics: Array, Binary Search, Divide and Conquer, Binary Indexed Tree, Segment Tree, Merge Sort, Ordered Set
- 287. Find the Duplicate Number - Medium - Binary SearchGiven an array of integers nums containing n + 1 integers where each integer is in the range [1, n] inclusive. There is only one repeated number in nu... Topics: Array, Two Pointers, Binary Search, Bit Manipulation
- 1352. Maximum Profit in Job Scheduling - Hard - Binary SearchWe have n jobs, where every job is scheduled to be done from startTime[i] to endTime[i], obtaining a profit of profit[i]. You're given the startTime, ... Topics: Array, Binary Search, Dynamic Programming, Sorting
- 912. Random Pick with Weight - Medium - Binary SearchYou are given a 0-indexed array of positive integers w where w[i] describes the weight of the ith index. You need to implement the function pickIndex(... Topics: Array, Math, Binary Search, Prefix Sum, Randomized
- 209. Minimum Size Subarray Sum - Medium - Binary SearchGiven an array of positive integers nums and a positive integer target, return the minimal length of a subarray whose sum is greater than or equal to ... Topics: Array, Binary Search, Sliding Window, Prefix Sum
- 278. First Bad Version - Easy - Binary SearchYou are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality c... Topics: Binary Search, Interactive
- 658. Find K Closest Elements - Medium - Binary SearchGiven a sorted integer array arr, two integers k and x, return the k closest integers to x in the array. The result should also be sorted in ascending... Topics: Array, Two Pointers, Binary Search, Sliding Window, Sorting, Heap (Priority Queue)
- 2047. Find a Peak Element II - Medium - Binary SearchA peak element in a 2D grid is an element that is strictly greater than all of its adjacent neighbors to the left, right, top, and bottom. Given a 0-i... Topics: Array, Binary Search, Matrix
- 349. Intersection of Two Arrays - Easy - Binary SearchGiven two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must be unique and you may return the resu... Topics: Array, Hash Table, Two Pointers, Binary Search, Sorting
- 456. 132 Pattern - Medium - Binary SearchGiven an array of n integers nums, a 132 pattern is a subsequence of three integers nums[i], nums[j] and nums[k] such that i < j < k and nums[i] < num... Topics: Array, Binary Search, Stack, Monotonic Stack, Ordered Set
- 794. Swim in Rising Water - Hard - Binary SearchYou are given an n x n integer matrix grid where each value grid[i][j] represents the elevation at that point (i, j). It starts raining, and water gra... Topics: Array, Binary Search, Depth-First Search, Breadth-First Search, Union Find, Heap (Priority Queue), Matrix
- 1646. Kth Missing Positive Number - Easy - Binary SearchGiven an array arr of positive integers sorted in a strictly increasing order, and an integer k. Return the kth positive integer that is missing from ... Topics: Array, Binary Search
- 350. Intersection of Two Arrays II - Easy - Binary SearchGiven two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must appear as many times as it shows in b... Topics: Array, Hash Table, Two Pointers, Binary Search, Sorting
- 81. Search in Rotated Sorted Array II - Medium - Binary SearchThere is an integer array nums sorted in non-decreasing order (not necessarily with distinct values). Before being passed to your function, nums is ro... Topics: Array, Binary Search
- 74. Search a 2D Matrix - Medium - Binary SearchYou are given an m x n integer matrix matrix with the following two properties: Each row is sorted in non-decreasing order. The first integer of each ... Topics: Array, Binary Search, Matrix
- 3267. Find Longest Special Substring That Occurs Thrice I - Medium - Binary SearchYou are given a string s that consists of lowercase English letters. A string is called special if it is made up of only a single character. For examp... Topics: Hash Table, String, Binary Search, Sliding Window, Counting
- 1056. Capacity To Ship Packages Within D Days - Medium - Binary SearchA conveyor belt has packages that must be shipped from one port to another within days days. The ith package on the conveyor belt has a weight of weig... Topics: Array, Binary Search
- 923. Super Egg Drop - Hard - Binary SearchYou are given k identical eggs and you have access to a building with n floors labeled from 1 to n. You know that there exists a floor f where 0 <= f ... Topics: Math, Binary Search, Dynamic Programming
- 907. Koko Eating Bananas - Medium - Binary SearchKoko loves to eat bananas. There are n piles of bananas, the ith pile has piles[i] bananas. The guards have gone and will come back in h hours. Koko c... Topics: Array, Binary Search
- 2150. Kth Smallest Product of Two Sorted Arrays - Hard - Binary SearchGiven two sorted 0-indexed integer arrays nums1 and nums2 as well as an integer k, return the kth (1-based) smallest product of nums1[i] * nums2[j] wh... Topics: Array, Binary Search
- 154. Find Minimum in Rotated Sorted Array II - Hard - Binary SearchSuppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,4,4,5,6,7] might become: [... Topics: Array, Binary Search
- 410. Split Array Largest Sum - Hard - Binary SearchGiven an integer array nums and an integer k, split nums into k non-empty subarrays such that the largest sum of any subarray is minimized. Return the... Topics: Array, Binary Search, Dynamic Programming, Greedy, Prefix Sum
- 1966. Frequency of the Most Frequent Element - Medium - Binary SearchThe frequency of an element is the number of times it occurs in an array. You are given an integer array nums and an integer k. In one operation, you ... Topics: Array, Binary Search, Greedy, Sliding Window, Sorting, Prefix Sum
- 3790. Fruits Into Baskets II - Easy - Binary SearchYou are given two arrays of integers, fruits and baskets, each of length n, where fruits[i] represents the quantity of the ith type of fruit, and bask... Topics: Array, Binary Search, Segment Tree, Simulation, Ordered Set
- 2600. Maximum Tastiness of Candy Basket - Medium - Binary SearchYou are given an array of positive integers price where price[i] denotes the price of the ith candy and a positive integer k. The store sells baskets ... Topics: Array, Binary Search, Greedy, Sorting
- 745. Find Smallest Letter Greater Than Target - Easy - Binary SearchYou are given an array of characters letters that is sorted in non-decreasing order, and a character target. There are at least two different characte... Topics: Array, Binary Search
- 540. Single Element in a Sorted Array - Medium - Binary SearchYou are given a sorted array consisting of only integers where every element appears exactly twice, except for one element which appears exactly once.... Topics: Array, Binary Search
- 1023. Time Based Key-Value Store - Medium - Binary SearchDesign a time-based key-value data structure that can store multiple values for the same key at different time stamps and retrieve the key's value at ... Topics: Hash Table, String, Binary Search, Design
- 35. Search Insert Position - Easy - Binary SearchGiven a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if i... Topics: Array, Binary Search
- 1605. Minimum Number of Days to Make m Bouquets - Medium - Binary SearchYou are given an integer array bloomDay, an integer m and an integer k. You want to make m bouquets. To make a bouquet, you need to use k adjacent flo... Topics: Array, Binary Search
- 240. Search a 2D Matrix II - Medium - Binary SearchWrite an efficient algorithm that searches for a value target in an m x n integer matrix matrix. This matrix has the following properties: Integers in... Topics: Array, Binary Search, Divide and Conquer, Matrix
- 1397. Search Suggestions System - Medium - Binary SearchYou are given an array of strings products and a string searchWord. Design a system that suggests at most three product names from products after each... Topics: Array, String, Binary Search, Trie, Sorting, Heap (Priority Queue)
- 367. Valid Perfect Square - Easy - Binary SearchGiven a positive integer num, return true if num is a perfect square or false otherwise. A perfect square is an integer that is the square of an integ... Topics: Math, Binary Search
- 2591. Frog Jump II - Medium - Binary SearchYou are given a 0-indexed integer array stones sorted in strictly increasing order representing the positions of stones in a river. A frog, initially ... Topics: Array, Binary Search, Greedy
- 755. Reach a Number - Medium - Binary SearchYou are standing at position 0 on an infinite number line. There is a destination at position target. You can make some number of moves numMoves so th... Topics: Math, Binary Search
- 2567. Closest Nodes Queries in a Binary Search Tree - Medium - Binary SearchYou are given the root of a binary search tree and an array queries of size n consisting of positive integers. Find a 2D array answer of size n where ... Topics: Array, Binary Search, Tree, Depth-First Search, Binary Search Tree, Binary Tree
- 352. Data Stream as Disjoint Intervals - Hard - Binary SearchGiven a data stream input of non-negative integers a1, a2, ..., an, summarize the numbers seen so far as a list of disjoint intervals. Implement the S... Topics: Binary Search, Design, Ordered Set
- 1408. Find the Smallest Divisor Given a Threshold - Medium - Binary SearchGiven an array of integers nums and an integer threshold, we will choose a positive integer divisor, divide all the array by it, and sum the division'... Topics: Array, Binary Search
- 882. Peak Index in a Mountain Array - Medium - Binary SearchYou are given an integer mountain array arr of length n where the values increase to a peak element and then decrease. Return the index of the peak el... Topics: Array, Binary Search
- 1886. Minimum Limit of Balls in a Bag - Medium - Binary SearchYou are given an integer array nums where the ith bag contains nums[i] balls. You are also given an integer maxOperations. You can perform the followi... Topics: Array, Binary Search
- 1753. Path With Minimum Effort - Medium - Binary SearchYou are a hiker preparing for an upcoming hike. You are given heights, a 2D array of size rows x columns, where heights[row][col] represents the heigh... Topics: Array, Binary Search, Depth-First Search, Breadth-First Search, Union Find, Heap (Priority Queue), Matrix
- 2690. House Robber IV - Medium - Binary SearchThere are several consecutive houses along a street, each of which has some money inside. There is also a robber, who wants to steal money from the ho... Topics: Array, Binary Search, Dynamic Programming, Greedy
- 3437. Maximum Total Damage With Spell Casting - Medium - Binary SearchA magician has various spells. You are given an array power, where each element represents the damage of a spell. Multiple spells can have the same da... Topics: Array, Hash Table, Two Pointers, Binary Search, Dynamic Programming, Sorting, Counting
- 2344. Escape the Spreading Fire - Hard - Binary SearchYou are given a 0-indexed 2D integer array grid of size m x n which represents a field. Each cell has one of three values: 0 represents grass, 1 repre... Topics: Array, Binary Search, Breadth-First Search, Matrix
- 2210. Find Target Indices After Sorting Array - Easy - Binary SearchYou are given a 0-indexed integer array nums and a target element target. A target index is an index i such that nums[i] == target. Return a list of t... Topics: Array, Binary Search, Sorting
- 892. Shortest Subarray with Sum at Least K - Hard - Binary SearchGiven an integer array nums and an integer k, return the length of the shortest non-empty subarray of nums with a sum of at least k. If there is no su... Topics: Array, Binary Search, Queue, Sliding Window, Heap (Priority Queue), Prefix Sum, Monotonic Queue
- 713. Subarray Product Less Than K - Medium - Binary SearchGiven an array of integers nums and an integer k, return the number of contiguous subarrays where the product of all the elements in the subarray is s... Topics: Array, Binary Search, Sliding Window, Prefix Sum
- 2162. Partition Array Into Two Arrays to Minimize Sum Difference - Hard - Binary SearchYou are given an integer array nums of 2 * n integers. You need to partition nums into two arrays of length n to minimize the absolute difference of t... Topics: Array, Two Pointers, Binary Search, Dynamic Programming, Bit Manipulation, Ordered Set, Bitmask
- 2165. Plates Between Candles - Medium - Binary SearchThere is a long table with a line of plates and candles arranged on top of it. You are given a 0-indexed string s consisting of characters '*' and '|'... Topics: Array, String, Binary Search, Prefix Sum
- 2449. Maximum Number of Robots Within Budget - Hard - Binary SearchYou have n robots. You are given two 0-indexed integer arrays, chargeTimes and runningCosts, both of length n. The ith robot costs chargeTimes[i] unit... Topics: Array, Binary Search, Queue, Sliding Window, Heap (Priority Queue), Prefix Sum, Monotonic Queue
- 1776. Minimum Operations to Reduce X to Zero - Medium - Binary SearchYou are given an integer array nums and an integer x. In one operation, you can either remove the leftmost or the rightmost element from the array num... Topics: Array, Hash Table, Binary Search, Sliding Window, Prefix Sum
- 1929. Maximum Value at a Given Index in a Bounded Array - Medium - Binary SearchYou are given three positive integers: n, index, and maxSum. You want to construct an array nums (0-indexed) that satisfies the following conditions: ... Topics: Math, Binary Search, Greedy
- 2392. Successful Pairs of Spells and Potions - Medium - Binary SearchYou are given two positive integer arrays spells and potions, of length n and m respectively, where spells[i] represents the strength of the ith spell... Topics: Array, Two Pointers, Binary Search, Sorting
- 2119. Minimum Number of Operations to Make Array Continuous - Hard - Binary SearchYou are given an integer array nums. In one operation, you can replace any element in nums with any integer. nums is considered continuous if both of ... Topics: Array, Hash Table, Binary Search, Sliding Window
- 611. Valid Triangle Number - Medium - Binary SearchGiven an integer array nums, return the number of triplets chosen from the array that can make triangles if we take them as side lengths of a triangle... Topics: Array, Two Pointers, Binary Search, Greedy, Sorting
- 3435. Block Placement Queries - Hard - Binary SearchThere exists an infinite number line, with its origin at 0 and extending towards the positive x-axis. You are given a 2D array queries, which contains... Topics: Array, Binary Search, Binary Indexed Tree, Segment Tree
- 1861. Building Boxes - Hard - Binary SearchYou have a cubic storeroom where the width, length, and height of the room are all equal to n units. You are asked to place n boxes in this room where... Topics: Math, Binary Search, Greedy
- 1957. Closest Room - Hard - Binary SearchThere is a hotel with n rooms. The rooms are represented by a 2D integer array rooms where rooms[i] = [roomIdi, sizei] denotes that there is a room wi... Topics: Array, Binary Search, Sorting, Ordered Set
- 2118. Maximum Earnings From Taxi - Medium - Binary SearchThere are n points on a road you are driving your taxi on. The n points on the road are labeled from 1 to n in the direction you are going, and you wa... Topics: Array, Hash Table, Binary Search, Dynamic Programming, Sorting
- 3496. Minimum Number of Seconds to Make Mountain Height Zero - Medium - Binary SearchYou are given an integer mountainHeight denoting the height of a mountain. You are also given an integer array workerTimes representing the work time ... Topics: Array, Math, Binary Search, Greedy, Heap (Priority Queue)
- 327. Count of Range Sum - Hard - Binary SearchGiven an integer array nums and two integers lower and upper, return the number of range sums that lie in [lower, upper] inclusive. Range sum S(i, j) ... Topics: Array, Binary Search, Divide and Conquer, Binary Indexed Tree, Segment Tree, Merge Sort, Ordered Set
- 3181. Find Building Where Alice and Bob Can Meet - Hard - Binary SearchYou are given a 0-indexed array heights of positive integers, where heights[i] represents the height of the ith building. If a person is in building i... Topics: Array, Binary Search, Stack, Binary Indexed Tree, Segment Tree, Heap (Priority Queue), Monotonic Stack
- 1358. Find Positive Integer Solution for a Given Equation - Medium - Binary SearchGiven a callable function f(x, y) with a hidden formula and a value z, reverse engineer the formula and return all positive integer pairs x and y wher... Topics: Math, Two Pointers, Binary Search, Interactive
- 532. K-diff Pairs in an Array - Medium - Binary SearchGiven an array of integers nums and an integer k, return the number of unique k-diff pairs in the array. A k-diff pair is an integer pair (nums[i], nu... Topics: Array, Hash Table, Two Pointers, Binary Search, Sorting
- 1984. Maximum Distance Between a Pair of Values - Medium - Binary SearchYou are given two non-increasing 0-indexed integer arrays nums1 and nums2. A pair of indices (i, j), where 0 <= i < nums1.length and 0 <= ... Topics: Array, Two Pointers, Binary Search
- 3571. Length of the Longest Increasing Path - Hard - Binary SearchYou are given a 2D array of integers coordinates of length n and an integer k, where 0 <= k < n. coordinates[i] = [xi, yi] indicates the point (xi, yi... Topics: Array, Binary Search, Sorting
- 1946. Minimum Absolute Sum Difference - Medium - Binary SearchYou are given two positive integer arrays nums1 and nums2, both of length n. The absolute sum difference of arrays nums1 and nums2 is defined as the s... Topics: Array, Binary Search, Sorting, Ordered Set
- 1851. Maximum Number of Events That Can Be Attended II - Hard - Binary SearchYou are given an array of events where events[i] = [startDayi, endDayi, valuei]. The ith event starts at startDayi and ends at endDayi, and if you att... Topics: Array, Binary Search, Dynamic Programming, Sorting
- 633. Sum of Square Numbers - Medium - Binary SearchGiven a non-negative integer c, decide whether there're two integers a and b such that a2 + b2 = c.... Topics: Math, Two Pointers, Binary Search
- 2060. Merge BSTs to Create Single BST - Hard - Binary SearchYou are given n BST (binary search tree) root nodes for n separate BSTs stored in an array trees (0-indexed). Each BST in trees has at most 3 nodes, a... Topics: Hash Table, Binary Search, Tree, Depth-First Search, Binary Tree
- 910. Nth Magical Number - Hard - Binary SearchA positive integer is magical if it is divisible by either a or b. Given the three integers n, a, and b, return the nth magical number. Since the answ... Topics: Math, Binary Search
- 732. My Calendar III - Hard - Binary SearchA k-booking happens when k events have some non-empty intersection (i.e., there is some time that is common to all k events.) You are given some event... Topics: Binary Search, Design, Segment Tree, Prefix Sum, Ordered Set
- 3919. Network Recovery Pathways - Hard - Binary SearchYou are given a directed acyclic graph of n nodes numbered from 0 to n − 1. This is represented by a 2D array edges of length m, where edges[i] = [ui,... Topics: Array, Binary Search, Dynamic Programming, Graph, Topological Sort, Heap (Priority Queue), Shortest Path
- 3791. Fruits Into Baskets III - Medium - Binary SearchYou are given two arrays of integers, fruits and baskets, each of length n, where fruits[i] represents the quantity of the ith type of fruit, and bask... Topics: Array, Binary Search, Segment Tree, Ordered Set
- 493. Reverse Pairs - Hard - Binary SearchGiven an integer array nums, return the number of reverse pairs in the array. A reverse pair is a pair (i, j) where: 0 <= i < j < nums.length and nums... Topics: Array, Binary Search, Divide and Conquer, Binary Indexed Tree, Segment Tree, Merge Sort, Ordered Set
- 2334. Number of Flowers in Full Bloom - Hard - Binary SearchYou are given a 0-indexed 2D integer array flowers, where flowers[i] = [starti, endi] means the ith flower will be in full bloom from starti to endi (... Topics: Array, Hash Table, Binary Search, Sorting, Prefix Sum, Ordered Set
- 894. Random Pick with Blacklist - Hard - Binary SearchYou are given an integer n and an array of unique integers blacklist. Design an algorithm to pick a random integer in the range [0, n - 1] that is not... Topics: Array, Hash Table, Math, Binary Search, Sorting, Randomized
- 354. Russian Doll Envelopes - Hard - Binary SearchYou are given a 2D array of integers envelopes where envelopes[i] = [wi, hi] represents the width and the height of an envelope. One envelope can fit ... Topics: Array, Binary Search, Dynamic Programming, Sorting
- 924. Fair Candy Swap - Easy - Binary SearchAlice and Bob have a different total number of candies. You are given two integer arrays aliceSizes and bobSizes where aliceSizes[i] is the number of ... Topics: Array, Hash Table, Binary Search, Sorting
- 2665. Minimum Time to Repair Cars - Medium - Binary SearchYou are given an integer array ranks representing the ranks of some mechanics. ranksi is the rank of the ith mechanic. A mechanic with a rank r can re... Topics: Array, Binary Search
- 718. Maximum Length of Repeated Subarray - Medium - Binary SearchGiven two integer arrays nums1 and nums2, return the maximum length of a subarray that appears in both arrays.... Topics: Array, Binary Search, Dynamic Programming, Sliding Window, Rolling Hash, Hash Function
- 1249. Snapshot Array - Medium - Binary SearchImplement a SnapshotArray that supports the following interface: SnapshotArray(int length) initializes an array-like data structure with the given len... Topics: Array, Hash Table, Binary Search, Design
- 1335. Maximum Candies Allocated to K Children - Medium - Binary SearchYou are given a 0-indexed integer array candies. Each element in the array denotes a pile of candies of size candies[i]. You can divide each pile into... Topics: Array, Binary Search
- 2180. Maximum Number of Tasks You Can Assign - Hard - Binary SearchYou have n tasks and m workers. Each task has a strength requirement stored in a 0-indexed integer array tasks, with the ith task requiring tasks[i] s... Topics: Array, Two Pointers, Binary Search, Greedy, Queue, Sorting, Monotonic Queue
- 1771. Sell Diminishing-Valued Colored Balls - Medium - Binary SearchYou have an inventory of different colored balls, and there is a customer that wants orders balls of any color. The customer weirdly values the colore... Topics: Array, Math, Binary Search, Greedy, Sorting, Heap (Priority Queue)
- 1573. Find Two Non-overlapping Sub-arrays Each With Target Sum - Medium - Binary SearchYou are given an array of integers arr and an integer target. You have to find two non-overlapping sub-arrays of arr each with a sum equal target. The... Topics: Array, Hash Table, Binary Search, Dynamic Programming, Sliding Window
- 3967. Earliest Finish Time for Land and Water Rides II - Medium - Binary SearchYou are given two categories of theme park attractions: land rides and water rides. Land rides landStartTime[i] – the earliest time the ith land ride ... Topics: Array, Two Pointers, Binary Search, Greedy, Sorting
- 1290. Make Array Strictly Increasing - Hard - Binary SearchGiven two integer arrays arr1 and arr2, return the minimum number of operations (possibly zero) needed to make arr1 strictly increasing. In one operat... Topics: Array, Binary Search, Dynamic Programming, Sorting
- 3944. Minimum Time to Activate String - Medium - Binary SearchYou are given a string s of length n and an integer array order, where order is a permutation of the numbers in the range [0, n - 1]. Starting from ti... Topics: Array, Binary Search
- 1772. Create Sorted Array through Instructions - Hard - Binary SearchGiven an integer array instructions, you are asked to create a sorted array from the elements in instructions. You start with an empty container nums.... Topics: Array, Binary Search, Divide and Conquer, Binary Indexed Tree, Segment Tree, Merge Sort, Ordered Set
- 2027. Maximum Number of Removable Characters - Medium - Binary SearchYou are given two strings s and p where p is a subsequence of s. You are also given a distinct 0-indexed integer array removable containing a subset o... Topics: Array, Two Pointers, String, Binary Search
- 3908. Minimum Time for K Connected Components - Medium - Binary SearchYou are given an integer n and an undirected graph with n nodes labeled from 0 to n - 1. This is represented by a 2D array edges, where edges[i] = [ui... Topics: Binary Search, Union Find, Graph, Sorting
- 2563. Split Message Based on Limit - Hard - Binary SearchYou are given a string, message, and a positive integer, limit. You must split message into one or more parts based on limit. Each resulting part shou... Topics: String, Binary Search, Enumeration
- 1122. Longest Duplicate Substring - Hard - Binary SearchGiven a string s, consider all duplicated substrings: (contiguous) substrings of s that occur 2 or more times. The occurrences may overlap. Return any... Topics: String, Binary Search, Sliding Window, Rolling Hash, Suffix Array, Hash Function
- 2979. Maximize the Profit as the Salesman - Medium - Binary SearchYou are given an integer n representing the number of houses on a number line, numbered from 0 to n - 1. Additionally, you are given a 2D integer arra... Topics: Array, Hash Table, Binary Search, Dynamic Programming, Sorting
- 853. Most Profit Assigning Work - Medium - Binary SearchYou have n jobs and m workers. You are given three arrays: difficulty, profit, and worker where: difficulty[i] and profit[i] are the difficulty and th... Topics: Array, Two Pointers, Binary Search, Greedy, Sorting
- 2134. Maximize the Confusion of an Exam - Medium - Binary SearchA teacher is writing a test with n true/false questions, with 'T' denoting true and 'F' denoting false. He wants to confuse the students by maximizing... Topics: String, Binary Search, Sliding Window, Prefix Sum
- 2914. Find the Safest Path in a Grid - Medium - Binary SearchYou are given a 0-indexed 2D matrix grid of size n x n, where (r, c) represents: A cell containing a thief if grid[r][c] = 1 An empty cell if grid[r][... Topics: Array, Binary Search, Breadth-First Search, Union Find, Heap (Priority Queue), Matrix
- 2832. Find the Longest Equal Subarray - Medium - Binary SearchYou are given a 0-indexed integer array nums and an integer k. A subarray is called equal if all of its elements are equal. Note that the empty subarr... Topics: Array, Hash Table, Binary Search, Sliding Window
- 1766. Minimum Number of Removals to Make Mountain Array - Hard - Binary SearchYou may recall that an array arr is a mountain array if and only if: arr.length >= 3 There exists some index i (0-indexed) with 0 < i < arr.length - 1... Topics: Array, Binary Search, Dynamic Programming, Greedy
- 1273. Compare Strings by Frequency of the Smallest Character - Medium - Binary SearchLet the function f(s) be the frequency of the lexicographically smallest character in a non-empty string s. For example, if s = "dcce" then f(s) = 2 b... Topics: Array, Hash Table, String, Binary Search, Sorting
- 2018. Minimum Space Wasted From Packaging - Hard - Binary SearchYou have n packages that you are trying to place in boxes, one package in each box. There are m suppliers that each produce boxes of different sizes (... Topics: Array, Binary Search, Sorting, Prefix Sum
- 3303. Find Beautiful Indices in the Given Array II - Hard - Binary SearchYou are given a 0-indexed string s, a string a, a string b, and an integer k. An index i is beautiful if: 0 <= i <= s.length - a.length s[i..(i + a.le... Topics: Two Pointers, String, Binary Search, Rolling Hash, String Matching, Hash Function
- 400. Nth Digit - Medium - Binary SearchGiven an integer n, return the nth digit of the infinite integer sequence [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ...].... Topics: Math, Binary Search
- 3382. Find the Number of Subarrays Where Boundary Elements Are Maximum - Hard - Binary SearchYou are given an array of positive integers nums. Return the number of subarrays of nums, where the first and the last elements of the subarray are eq... Topics: Array, Binary Search, Stack, Monotonic Stack
- 3720. Minimize the Maximum Edge Weight of Graph - Medium - Binary SearchYou are given two integers, n and threshold, as well as a directed weighted graph of n nodes numbered from 0 to n - 1. The graph is represented by a 2... Topics: Binary Search, Depth-First Search, Breadth-First Search, Graph, Shortest Path
- 2614. Maximum Count of Positive Integer and Negative Integer - Easy - Binary SearchGiven an array nums sorted in non-decreasing order, return the maximum between the number of positive integers and the number of negative integers. In... Topics: Array, Binary Search, Counting
- 3690. Smallest Substring With Identical Characters I - Hard - Binary SearchYou are given a binary string s of length n and an integer numOps. You are allowed to perform the following operation on s at most numOps times: Selec... Topics: Array, Binary Search, Enumeration
- 3965. Earliest Finish Time for Land and Water Rides I - Easy - Binary SearchYou are given two categories of theme park attractions: land rides and water rides. Land rides landStartTime[i] – the earliest time the ith land ride ... Topics: Array, Two Pointers, Binary Search, Greedy, Sorting
- 3900. Find Weighted Median Node in Tree - Hard - Binary SearchYou are given an integer n and an undirected, weighted tree rooted at node 0 with n nodes numbered from 0 to n - 1. This is represented by a 2D array ... Topics: Array, Binary Search, Dynamic Programming, Tree, Depth-First Search
- 1675. Magnetic Force Between Two Balls - Medium - Binary SearchIn the universe Earth C-137, Rick discovered a special form of magnetic force between two balls if they are put in his new invented basket. Rick has n... Topics: Array, Binary Search, Sorting
- 3562. Maximum Score of Non-overlapping Intervals - Hard - Binary SearchYou are given a 2D integer array intervals, where intervals[i] = [li, ri, weighti]. Interval i starts at position li and ends at ri, and has a weight ... Topics: Array, Binary Search, Dynamic Programming, Sorting
- 3292. Earliest Second to Mark Indices I - Medium - Binary SearchYou are given two 1-indexed integer arrays, nums and, changeIndices, having lengths n and m, respectively. Initially, all indices in nums are unmarked... Topics: Array, Binary Search
- 3920. Minimum Stability Factor of Array - Hard - Binary SearchYou are given an integer array nums and an integer maxC. A subarray is called stable if the highest common factor (HCF) of all its elements is greater... Topics: Array, Math, Binary Search, Greedy, Segment Tree, Number Theory
- 1185. Find in Mountain Array - Hard - Binary Search(This problem is an interactive problem.) You may recall that an array arr is a mountain array if and only if: arr.length >= 3 There exists some i wit... Topics: Array, Binary Search, Interactive
- 1918. Maximum Score of a Good Subarray - Hard - Binary SearchYou are given an array of integers nums (0-indexed) and an integer k. The score of a subarray (i, j) is defined as min(nums[i], nums[i+1], ..., nums[j... Topics: Array, Two Pointers, Binary Search, Stack, Monotonic Stack
- 2229. Maximum Fruits Harvested After at Most K Steps - Hard - Binary SearchFruits are available at some positions on an infinite x-axis. You are given a 2D integer array fruits where fruits[i] = [positioni, amounti] depicts a... Topics: Array, Binary Search, Sliding Window, Prefix Sum
- 802. K-th Smallest Prime Fraction - Medium - Binary SearchYou are given a sorted integer array arr containing 1 and prime numbers, where all the integers of arr are unique. You are also given an integer k. Fo... Topics: Array, Two Pointers, Binary Search, Sorting, Heap (Priority Queue)
- 1645. Find a Value of a Mysterious Function Closest to Target - Hard - Binary SearchWinston was given the above mysterious function func. He has an integer array arr and an integer target and he wants to find the values l and r that m... Topics: Array, Binary Search, Bit Manipulation, Segment Tree
- 2640. Maximum Number of Integers to Choose From a Range I - Medium - Binary SearchYou are given an integer array banned and two integers n and maxSum. You are choosing some number of integers following the below rules: The chosen in... Topics: Array, Hash Table, Binary Search, Greedy, Sorting
- 3881. Minimize Maximum Component Cost - Medium - Binary SearchYou are given an undirected connected graph with n nodes labeled from 0 to n - 1 and a 2D integer array edges where edges[i] = [ui, vi, wi] denotes an... Topics: Binary Search, Union Find, Graph, Sorting
- 2699. Count the Number of Fair Pairs - Medium - Binary SearchGiven a 0-indexed integer array nums of size n and two integers lower and upper, return the number of fair pairs. A pair (i, j) is fair if: 0 <= i < j... Topics: Array, Two Pointers, Binary Search, Sorting
- 2513. Number of Pairs Satisfying Inequality - Hard - Binary SearchYou are given two 0-indexed integer arrays nums1 and nums2, each of size n, and an integer diff. Find the number of pairs (i, j) such that: 0 <= i < j... Topics: Array, Binary Search, Divide and Conquer, Binary Indexed Tree, Segment Tree, Merge Sort, Ordered Set
- 2765. Make Array Empty - Hard - Binary SearchYou are given an integer array nums containing distinct numbers, and you can perform the following operations until the array is empty: If the first e... Topics: Array, Binary Search, Greedy, Binary Indexed Tree, Segment Tree, Sorting, Ordered Set
- 1307. Ugly Number III - Medium - Binary SearchAn ugly number is a positive integer that is divisible by a, b, or c. Given four integers n, a, b, and c, return the nth ugly number.... Topics: Math, Binary Search, Combinatorics, Number Theory
- 3000. Minimum Absolute Difference Between Elements With Constraint - Medium - Binary SearchYou are given a 0-indexed integer array nums and an integer x. Find the minimum absolute difference between two elements in the array that are at leas... Topics: Array, Binary Search, Ordered Set
- 2417. The Latest Time to Catch a Bus - Medium - Binary SearchYou are given a 0-indexed integer array buses of length n, where buses[i] represents the departure time of the ith bus. You are also given a 0-indexed... Topics: Array, Two Pointers, Binary Search, Sorting
- 2628. Minimize the Maximum of Two Arrays - Medium - Binary SearchWe have two arrays arr1 and arr2 which are initially empty. You need to add positive integers to them such that they satisfy all the following conditi... Topics: Math, Binary Search, Number Theory
- 1295. Minimum Garden Perimeter to Collect Enough Apples - Medium - Binary SearchIn a garden represented as an infinite 2D grid, there is an apple tree planted at every integer coordinate. The apple tree planted at an integer coord... Topics: Math, Binary Search
- 3762. Maximize the Minimum Game Score - Hard - Binary SearchYou are given an array points of size n and an integer m. There is another array gameScore of size n, where gameScore[i] represents the score achieved... Topics: Array, Binary Search, Greedy
- 2701. Subsequence With the Minimum Score - Hard - Binary SearchYou are given two strings s and t. You are allowed to remove any number of characters from the string t. The score of the string is 0 if no characters... Topics: Two Pointers, String, Binary Search
- 2164. Two Best Non-Overlapping Events - Medium - Binary SearchYou are given a 0-indexed 2D integer array of events where events[i] = [startTimei, endTimei, valuei]. The ith event starts at startTimei and ends at ... Topics: Array, Binary Search, Dynamic Programming, Sorting, Heap (Priority Queue)
- 1463. The K Weakest Rows in a Matrix - Easy - Binary SearchYou are given an m x n binary matrix mat of 1's (representing soldiers) and 0's (representing civilians). The soldiers are positioned in front of the ... Topics: Array, Binary Search, Sorting, Heap (Priority Queue), Matrix
- 3622. Maximum Frequency of an Element After Performing Operations I - Medium - Binary SearchYou are given an integer array nums and two integers k and numOperations. You must perform an operation numOperations times on nums, where in each ope... Topics: Array, Binary Search, Sliding Window, Sorting, Prefix Sum
- 2891. Maximum Beauty of an Array After Applying Operation - Medium - Binary SearchYou are given a 0-indexed array nums and a non-negative integer k. In one operation, you can do the following: Choose an index i that hasn't been chos... Topics: Array, Binary Search, Sliding Window, Sorting
- 2280. Count Good Triplets in an Array - Hard - Binary SearchYou are given two 0-indexed arrays nums1 and nums2 of length n, both of which are permutations of [0, 1, ..., n - 1]. A good triplet is a set of 3 dis... Topics: Array, Binary Search, Divide and Conquer, Binary Indexed Tree, Segment Tree, Merge Sort, Ordered Set
- 2394. Count Subarrays With Score Less Than K - Hard - Binary SearchThe score of an array is defined as the product of its sum and its length. For example, the score of [1, 2, 3, 4, 5] is (1 + 2 + 3 + 4 + 5) * 5 = 75. ... Topics: Array, Binary Search, Sliding Window, Prefix Sum
- 2904. Sorting Three Groups - Medium - Binary SearchYou are given an integer array nums. Each element in nums is 1, 2 or 3. In each operation, you can remove an element from nums. Return the minimum num... Topics: Array, Binary Search, Dynamic Programming
- 1831. Ways to Split Array Into Three Subarrays - Medium - Binary SearchA split of an integer array is good if: The array is split into three non-empty contiguous subarrays - named left, mid, right respectively from left t... Topics: Array, Two Pointers, Binary Search, Prefix Sum
- 1321. Get Equal Substrings Within Budget - Medium - Binary SearchYou are given two strings s and t of the same length and an integer maxCost. You want to change s to t. Changing the ith character of s to ith charact... Topics: String, Binary Search, Sliding Window, Prefix Sum
- 2720. Minimize the Maximum Difference of Pairs - Medium - Binary SearchYou are given a 0-indexed integer array nums and an integer p. Find p pairs of indices of nums such that the maximum difference amongst all the pairs ... Topics: Array, Binary Search, Dynamic Programming, Greedy, Sorting
- 2469. Longest Subsequence With Limited Sum - Easy - Binary SearchYou are given an integer array nums of length n, and an integer array queries of length m. Return an array answer of length m where answer[i] is the m... Topics: Array, Binary Search, Greedy, Sorting, Prefix Sum
- 852. Friends Of Appropriate Ages - Medium - Binary SearchThere are n persons on a social media website. You are given an integer array ages where ages[i] is the age of the ith person. A Person x will not sen... Topics: Array, Two Pointers, Binary Search, Sorting
- 1296. Kth Ancestor of a Tree Node - Hard - Binary SearchYou are given a tree with n nodes numbered from 0 to n - 1 in the form of a parent array parent where parent[i] is the parent of ith node. The root of... Topics: Binary Search, Dynamic Programming, Tree, Depth-First Search, Breadth-First Search, Design
- 3763. Separate Squares I - Medium - Binary SearchYou are given a 2D integer array squares. Each squares[i] = [xi, yi, li] represents the coordinates of the bottom-left point and the side length of a ... Topics: Array, Binary Search
- 2330. Maximum Total Beauty of the Gardens - Hard - Binary SearchAlice is a caretaker of n gardens and she wants to plant flowers to maximize the total beauty of all her gardens. You are given a 0-indexed integer ar... Topics: Array, Two Pointers, Binary Search, Greedy, Sorting, Enumeration, Prefix Sum
- 2051. Longest Common Subpath - Hard - Binary SearchThere is a country of n cities numbered from 0 to n - 1. In this country, there is a road connecting every pair of cities. There are m friends numbere... Topics: Array, Binary Search, Rolling Hash, Suffix Array, Hash Function
- 668. Kth Smallest Number in Multiplication Table - Hard - Binary SearchNearly everyone has used the Multiplication Table. The multiplication table of size m x n is an integer matrix mat where mat[i][j] == i * j (1-indexed... Topics: Math, Binary Search
- 2006. Find the Student that Will Replace the Chalk - Medium - Binary SearchThere are n students in a class numbered from 0 to n - 1. The teacher will give each student a problem starting with the student number 0, then the st... Topics: Array, Binary Search, Simulation, Prefix Sum
- 1468. Check If N and Its Double Exist - Easy - Binary SearchGiven an array arr of integers, check if there exist two indices i and j such that : i != j 0 <= i, j < arr.length arr[i] == 2 * arr[j]... Topics: Array, Hash Table, Two Pointers, Binary Search, Sorting
- 914. Random Point in Non-overlapping Rectangles - Medium - Binary SearchYou are given an array of non-overlapping axis-aligned rectangles rects where rects[i] = [ai, bi, xi, yi] indicates that (ai, bi) is the bottom-left c... Topics: Array, Math, Binary Search, Reservoir Sampling, Prefix Sum, Ordered Set, Randomized
- 1087. Longest Arithmetic Subsequence - Medium - Binary SearchGiven an array nums of integers, return the length of the longest arithmetic subsequence in nums. Note that: A subsequence is an array that can be der... Topics: Array, Hash Table, Binary Search, Dynamic Programming
- 808. Number of Matching Subsequences - Medium - Binary SearchGiven a string s and an array of strings words, return the number of words[i] that is a subsequence of s. A subsequence of a string is a new string ge... Topics: Array, Hash Table, String, Binary Search, Dynamic Programming, Trie, Sorting
- 1470. Tweet Counts Per Frequency - Medium - Binary SearchA social media company is trying to monitor activity on their site by analyzing the number of tweets that occur in select periods of time. These perio... Topics: Hash Table, Binary Search, Design, Sorting, Ordered Set
- 441. Arranging Coins - Easy - Binary SearchYou have n coins and you want to build a staircase with these coins. The staircase consists of k rows where the ith row has exactly i coins. The last ... Topics: Math, Binary Search
- 2530. Minimize Maximum of Array - Medium - Binary SearchYou are given a 0-indexed array nums comprising of n non-negative integers. In one operation, you must: Choose an integer i such that 1 <= i < n and n... Topics: Array, Binary Search, Dynamic Programming, Greedy, Prefix Sum
- 1232. Sum of Mutated Array Closest to Target - Medium - Binary SearchGiven an integer array arr and a target value target, return the integer value such that when we change all the integers larger than value in the give... Topics: Array, Binary Search, Sorting
- 1294. Range Frequency Queries - Medium - Binary SearchDesign a data structure to find the frequency of a given value in a given subarray. The frequency of a value in a subarray is the number of occurrence... Topics: Array, Hash Table, Binary Search, Design, Segment Tree
- 3902. Maximize Spanning Tree Stability with Upgrades - Hard - Binary SearchYou are given an integer n, representing n nodes numbered from 0 to n - 1 and a list of edges, where edges[i] = [ui, vi, si, musti]: ui and vi indicat... Topics: Binary Search, Greedy, Union Find, Graph, Minimum Spanning Tree
- 3095. Maximum Number of Alloys - Medium - Binary SearchYou are the owner of a company that creates alloys using various types of metals. There are n different types of metals available, and you have access... Topics: Array, Binary Search
- 3643. Zero Array Transformation II - Medium - Binary SearchYou are given an integer array nums of length n and a 2D array queries where queries[i] = [li, ri, vali]. Each queries[i] represents the following act... Topics: Array, Binary Search, Prefix Sum
- 3485. Maximize Score of Numbers in Ranges - Medium - Binary SearchYou are given an array of integers start and an integer d, representing n intervals [start[i], start[i] + d]. You are asked to choose n integers where... Topics: Array, Binary Search, Greedy, Sorting
- 3955. Threshold Majority Queries - Hard - Binary SearchYou are given an integer array nums of length n and an array queries, where queries[i] = [li, ri, thresholdi]. Return an array of integers ans where a... Topics: Array, Hash Table, Binary Search, Divide and Conquer, Counting, Prefix Sum
- 2538. Minimum Cost to Make Array Equal - Hard - Binary SearchYou are given two 0-indexed arrays nums and cost consisting each of n positive integers. You can do the following operation any number of times: Incre... Topics: Array, Binary Search, Greedy, Sorting, Prefix Sum
- 938. Numbers At Most N Given Digit Set - Hard - Binary SearchGiven an array of digits which is sorted in non-decreasing order. You can write numbers using each digits[i] as many times as we want. For example, if... Topics: Array, Math, String, Binary Search, Dynamic Programming
- 2380. Booking Concert Tickets in Groups - Hard - Binary SearchA concert hall has n rows numbered from 0 to n - 1, each with m seats, numbered from 0 to m - 1. You need to design a ticketing system that can alloca... Topics: Binary Search, Design, Binary Indexed Tree, Segment Tree
- 1621. Number of Subsequences That Satisfy the Given Sum Condition - Medium - Binary SearchYou are given an array of integers nums and an integer target. Return the number of non-empty subsequences of nums such that the sum of the minimum an... Topics: Array, Two Pointers, Binary Search, Sorting
- 475. Heaters - Medium - Binary SearchWinter is coming! During the contest, your first job is to design a standard heater with a fixed warm radius to warm all the houses. Every house can b... Topics: Array, Two Pointers, Binary Search, Sorting
- 2917. Count Pairs Whose Sum is Less than Target - Easy - Binary SearchGiven a 0-indexed integer array nums of length n and an integer target, return the number of pairs (i, j) where 0 <= i < j < n and nums[i] + nums[j] <... Topics: Array, Two Pointers, Binary Search, Sorting
- 731. My Calendar II - Medium - Binary SearchYou are implementing a program to use as your calendar. We can add a new event if adding the event will not cause a triple booking. A triple booking h... Topics: Array, Binary Search, Design, Segment Tree, Prefix Sum, Ordered Set
- 363. Max Sum of Rectangle No Larger Than K - Hard - Binary SearchGiven an m x n matrix matrix and an integer k, return the max sum of a rectangle in the matrix such that its sum is no larger than k. It is guaranteed... Topics: Array, Binary Search, Matrix, Prefix Sum, Ordered Set
- 2333. Count Number of Rectangles Containing Each Point - Medium - Binary SearchYou are given a 2D integer array rectangles where rectangles[i] = [li, hi] indicates that ith rectangle has a length of li and a height of hi. You are... Topics: Array, Hash Table, Binary Search, Binary Indexed Tree, Sorting
- 2673. Maximize Win From Two Segments - Medium - Binary SearchThere are some prizes on the X-axis. You are given an integer array prizePositions that is sorted in non-decreasing order, where prizePositions[i] is ... Topics: Array, Binary Search, Sliding Window
- 2418. Minimum Sum of Squared Difference - Medium - Binary SearchYou are given two positive 0-indexed integer arrays nums1 and nums2, both of length n. The sum of squared difference of arrays nums1 and nums2 is defi... Topics: Array, Binary Search, Greedy, Sorting, Heap (Priority Queue)
- 2549. Next Greater Element IV - Hard - Binary SearchYou are given a 0-indexed array of non-negative integers nums. For each integer in nums, you must find its respective second greater integer. The seco... Topics: Array, Binary Search, Stack, Sorting, Heap (Priority Queue), Monotonic Stack
- 2498. Smallest Subarrays With Maximum Bitwise OR - Medium - Binary SearchYou are given a 0-indexed array nums of length n, consisting of non-negative integers. For each index i from 0 to n - 1, you must determine the size o... Topics: Array, Binary Search, Bit Manipulation, Sliding Window
- 2359. Maximum White Tiles Covered by a Carpet - Medium - Binary SearchYou are given a 2D integer array tiles where tiles[i] = [li, ri] represents that every tile j in the range li <= j <= ri is colored white. You are als... Topics: Array, Binary Search, Greedy, Sliding Window, Sorting, Prefix Sum
- 2712. Find the Maximum Number of Marked Indices - Medium - Binary SearchYou are given a 0-indexed integer array nums. Initially, all of the indices are unmarked. You are allowed to make this operation any number of times: ... Topics: Array, Two Pointers, Binary Search, Greedy, Sorting
- 2634. Minimum Common Value - Easy - Binary SearchGiven two integer arrays nums1 and nums2, sorted in non-decreasing order, return the minimum integer common to both arrays. If there is no common inte... Topics: Array, Hash Table, Two Pointers, Binary Search
- 2188. Minimized Maximum of Products Distributed to Any Store - Medium - Binary SearchYou are given an integer n indicating there are n specialty retail stores. There are m product types of varying amounts, which are given as a 0-indexe... Topics: Array, Binary Search, Greedy
- 3706. Smallest Substring With Identical Characters II - Hard - Binary SearchYou are given a binary string s of length n and an integer numOps. You are allowed to perform the following operation on s at most numOps times: Selec... Topics: String, Binary Search
- 436. Find Right Interval - Medium - Binary SearchYou are given an array of intervals, where intervals[i] = [starti, endi] and each starti is unique. The right interval for an interval i is an interva... Topics: Array, Binary Search, Sorting
- 1413. Maximum Side Length of a Square with Sum Less than or Equal to Threshold - Medium - Binary SearchGiven a m x n matrix mat and an integer threshold, return the maximum side-length of a square with a sum less than or equal to threshold or return 0 i... Topics: Array, Binary Search, Matrix, Prefix Sum
- 1612. Avoid Flood in The City - Medium - Binary SearchYour country has an infinite number of lakes. Initially, all the lakes are empty, but when it rains over the nth lake, the nth lake becomes full of wa... Topics: Array, Hash Table, Binary Search, Greedy, Heap (Priority Queue)
- 2716. Prime Subtraction Operation - Medium - Binary SearchYou are given a 0-indexed integer array nums of length n. You can perform the following operation as many times as you want: Pick an index i that you ... Topics: Array, Math, Binary Search, Greedy, Number Theory
- 1476. Count Negative Numbers in a Sorted Matrix - Easy - Binary SearchGiven a m x n matrix grid which is sorted in non-increasing order both row-wise and column-wise, return the number of negative numbers in grid.... Topics: Array, Binary Search, Matrix
- 729. My Calendar I - Medium - Binary SearchYou are implementing a program to use as your calendar. We can add a new event if adding the event will not cause a double booking. A double booking h... Topics: Array, Binary Search, Design, Segment Tree, Ordered Set
Related LeetCode Topics
- Array LeetCode Problems
- Backtracking LeetCode Problems
- Biconnected Component LeetCode Problems
- Binary Indexed Tree LeetCode Problems
- Binary Search Tree LeetCode Problems
- Binary Tree LeetCode Problems
- Bit Manipulation LeetCode Problems
- Bitmask LeetCode Problems
- Brainteaser LeetCode Problems
- Breadth-First Search LeetCode Problems
- Bucket Sort LeetCode Problems
- Combinatorics LeetCode Problems
- Concurrency LeetCode Problems
- Counting LeetCode Problems
- Counting Sort LeetCode Problems
- Data Stream LeetCode Problems
- Database LeetCode Problems
- Depth-First Search LeetCode Problems
- Design LeetCode Problems
- Divide and Conquer LeetCode Problems