LeetCodechevron_rightCategorieschevron_rightarray
list

array

1672 problems
Easy: 363Medium: 876Hard: 433

array is one of the most repeated interview dimensions. Start with edge-safe fundamentals, then move into pattern-level trade-offs.

Interview Signal

Frequently tests problem modeling, edge handling, and verbal clarity.

Common Pitfall

Template-only answers break under follow-up questioning.

Practice Strategy

Practice in 3-5 problem rounds and always review complexity alternatives.

Recommended Progression

#TitleDifficulty
1

Two Sum

Two Sum is solved fastest by storing seen values in a hash map and checking each number's needed complement once.

Easy
4

Median of Two Sorted Arrays

Find the median of two sorted arrays using binary search for efficient O(log(min(m, n))) time complexity.

Hard
11

Container With Most Water

Find two vertical lines that can form a container with the most water in a given array of heights.

Medium
14

Longest Common Prefix

Find the longest common prefix in an array of strings, returning an empty string if none exists.

Easy
15

3Sum

Given an integer array, return all unique triplets where the sum is zero using two-pointer scanning with careful duplica…

Medium
16

3Sum Closest

Find the sum of three integers in an array that is closest to a given target using two-pointer scanning.

Medium
18

4Sum

The 4Sum problem requires finding all unique quadruplets in an array that sum to a specific target value.

Medium
26

Remove Duplicates from Sorted Array

Learn how to remove duplicates from a sorted array in-place using two-pointer scanning while preserving element order.

Easy
27

Remove Element

Remove Element challenges you to remove a value from an array in-place using efficient two-pointer scanning and tracking…

Easy
31

Next Permutation

Next Permutation is a medium-difficulty problem focusing on generating the next lexicographically greater permutation of…

Medium
33

Search in Rotated Sorted Array

Find the index of a target in a rotated sorted array using a careful binary search that handles pivot shifts.

Medium
34

Find First and Last Position of Element in Sorted Array

Locate the first and last index of a target in a sorted array using binary search for precise O(log n) performance.

Medium
35

Search Insert Position

Find the correct index for a target value in a sorted array using binary search, or return the position where it should …

Easy
36

Valid Sudoku

Check if a 9x9 Sudoku board is valid by scanning rows, columns, and sub-boxes with hash lookups, ensuring no duplicates …

Medium
37

Sudoku Solver

Solve the Sudoku puzzle by filling empty cells while respecting Sudoku's rules using array scanning and backtracking.

Hard
39

Combination Sum

Find all unique combinations of numbers from a distinct array that sum to a target using controlled backtracking search.

Medium
40

Combination Sum II

Find all unique combinations of numbers that sum to a target using backtracking with careful pruning to avoid duplicates…

Medium
41

First Missing Positive

Identify the smallest missing positive integer in an unsorted array using constant space and linear time scanning techni…

Hard
42

Trapping Rain Water

Calculate the total trapped rain water using the elevation map array, leveraging dynamic programming and two-pointer pat…

Hard
45

Jump Game II

Jump Game II requires finding the minimum jumps to reach the end of an array using dynamic programming and greedy techni…

Medium
46

Permutations

Generate all possible orderings of a distinct integer array using backtracking search with careful pruning to avoid dupl…

Medium
47

Permutations II

Generate all unique permutations of an array containing duplicates using backtracking and pruning to avoid repeated sequ…

Medium
48

Rotate Image

Rotate an n x n matrix 90 degrees clockwise in-place using array manipulation and mathematical indexing techniques effic…

Medium
49

Group Anagrams

Group the anagrams in a list of strings using efficient hash table-based methods, focusing on array scanning.

Medium
51

N-Queens

Solve the N-Queens problem using backtracking with pruning, exploring all valid board placements while avoiding conflict…

Hard
53

Maximum Subarray

Maximum Subarray is a classic state transition dynamic programming problem about deciding whether to extend or restart a…

Medium
54

Spiral Matrix

Given an m x n matrix, return all elements in spiral order starting from the top-left corner.

Medium
55

Jump Game

Solve the Jump Game problem using state transition dynamic programming to determine if you can reach the last index of t…

Medium
56

Merge Intervals

Merge Intervals requires sorting an array of interval pairs and combining overlaps efficiently using sequential comparis…

Medium
57

Insert Interval

Given a sorted array of non-overlapping intervals, insert a new interval and merge any overlapping intervals.

Medium
59

Spiral Matrix II

Generate a spiral matrix of size n x n, filled with elements from 1 to n² in spiral order, for interview-focused solving…

Medium
63

Unique Paths II

Calculate the number of unique paths from top-left to bottom-right in a grid with obstacles using dynamic programming st…

Medium
64

Minimum Path Sum

Compute the minimum sum from top-left to bottom-right in a grid using state transition dynamic programming efficiently.

Medium
66

Plus One

Given a number as an array of digits, increment it by one and return the updated array of digits.

Easy
68

Text Justification

Text Justification requires packing words into lines to match a specified width, ensuring even distribution of spaces.

Hard
73

Set Matrix Zeroes

Modify the matrix in place by setting rows and columns to zero when an element is zero.

Medium
74

Search a 2D Matrix

Search a 2D matrix efficiently using binary search over its linearized index, ensuring correctness in row-major sorted a…

Medium
75

Sort Colors

Sort Colors requires in-place reordering of an array using a two-pointer scanning strategy to group 0s, 1s, and 2s effic…

Medium
78

Subsets

Generate all subsets of a set of unique integers using backtracking with pruning to avoid duplicates.

Medium
79

Word Search

Solve Word Search with backtracking by exploring adjacent cells to match a target word in a grid.

Medium
80

Remove Duplicates from Sorted Array II

Solve the problem of removing duplicates from a sorted array in-place, ensuring each element appears at most twice, usin…

Medium
81

Search in Rotated Sorted Array II

Determine if a target exists in a rotated sorted array that may contain duplicates using a binary search variation effic…

Medium
84

Largest Rectangle in Histogram

Find the maximal rectangular area in a histogram using stack-based state management for precise bar tracking and width c…

Hard
85

Maximal Rectangle

Compute the largest rectangle of 1's in a binary matrix using dynamic programming and stack-based state transitions effi…

Hard
88

Merge Sorted Array

Merge two sorted arrays into the first array in non-decreasing order, using a two-pointer approach.

Easy
90

Subsets II

Subsets II problem asks to generate unique subsets from an array with possible duplicates using backtracking search with…

Medium
105

Construct Binary Tree from Preorder and Inorder Traversal

Construct a binary tree using preorder and inorder traversal arrays, leveraging array scanning and hash table lookups.

Medium
106

Construct Binary Tree from Inorder and Postorder Traversal

Reconstruct a binary tree from given inorder and postorder arrays using array scanning and hash lookup to optimize recur…

Medium
108

Convert Sorted Array to Binary Search Tree

Pick the middle element as root at each step so the sorted array becomes a height-balanced BST with valid ordering.

Easy
118

Pascal's Triangle

Generate the first numRows of Pascal's Triangle using dynamic programming with clear state transitions and array manipul…

Easy
119

Pascal's Triangle II

Compute the specific row of Pascal's Triangle using efficient state transition dynamic programming with array-based upda…

Easy
120

Triangle

Given a triangle, return the minimum path sum from top to bottom, moving to adjacent numbers in the row below.

Medium
121

Best Time to Buy and Sell Stock

Maximize stock profit by identifying the optimal buy and sell days using dynamic programming.

Easy
122

Best Time to Buy and Sell Stock II

Maximize stock profit by using a greedy approach to buy and sell multiple times, with state transition dynamic programmi…

Medium
123

Best Time to Buy and Sell Stock III

Determine the maximum profit from at most two stock transactions using state transition dynamic programming on price arr…

Hard
128

Longest Consecutive Sequence

Find the length of the longest consecutive elements sequence in an unsorted array using array scanning and hash lookup.

Medium
130

Surrounded Regions

Transform the matrix in-place by marking regions surrounded by 'X' as 'X', while keeping border-adjacent 'O's intact.

Medium
134

Gas Station

The Gas Station problem requires finding the starting station index for a full circular trip with gas stations and costs…

Medium
135

Candy

The Candy problem is a greedy algorithm challenge where you need to minimize candy distribution while satisfying certain…

Hard
136

Single Number

Solve the Single Number problem using an efficient approach with constant space and linear time complexity.

Easy
137

Single Number II

Find the single element in an array where every other element appears three times, using bit manipulation and constant s…

Medium
139

Word Break

Determine if a string can be fully segmented into dictionary words using array scanning and hash-based lookups for effic…

Medium
140

Word Break II

Given a string and dictionary, return all possible sentences by adding spaces where each word is in the dictionary.

Hard
149

Max Points on a Line

Find the maximum number of points on a straight line in a 2D plane using array scanning and hash lookup.

Hard
150

Evaluate Reverse Polish Notation

Compute the result of an arithmetic expression in Reverse Polish Notation using a stack to manage operands efficiently.

Medium
152

Maximum Product Subarray

Find the subarray with the largest product in an integer array using dynamic programming techniques.

Medium
153

Find Minimum in Rotated Sorted Array

Find the minimum element in a rotated sorted array using binary search to efficiently identify the point of rotation.

Medium
154

Find Minimum in Rotated Sorted Array II

Find the minimum in a rotated sorted array with possible duplicates using binary search.

Hard
162

Find Peak Element

Find Peak Element leverages binary search for efficiently locating a peak in an array, a problem commonly asked in techn…

Medium
164

Maximum Gap

Find the largest difference between successive elements in a sorted array efficiently using linear time techniques and b…

Medium
167

Two Sum II - Input Array Is Sorted

Solve the Two Sum II problem efficiently using binary search over a valid answer space in a sorted array.

Medium
169

Majority Element

Find the majority element in an array, where the element appears more than n/2 times, using efficient algorithms.

Easy
174

Dungeon Game

Calculate the minimum initial health the knight needs to survive the dungeon using state transition dynamic programming …

Hard
179

Largest Number

The problem asks to arrange integers to form the largest possible number, focusing on greedy algorithms and string handl…

Medium
188

Best Time to Buy and Sell Stock IV

Determine the maximum profit from at most k stock transactions using state transition dynamic programming on an array of…

Hard
189

Rotate Array

Rotate Array challenges you to shift elements right by k steps using precise two-pointer scanning and invariant tracking…

Medium
198

House Robber

Maximize the amount of money you can rob tonight without alerting the police by applying dynamic programming with state …

Medium
200

Number of Islands

Count the number of distinct islands in a binary grid using array traversal combined with depth-first search exploration…

Medium
204

Count Primes

Count all prime numbers less than a given integer n using efficient array and math-based enumeration techniques.

Medium
209

Minimum Size Subarray Sum

Find the minimal length of a subarray whose sum is greater than or equal to the target using efficient algorithms.

Medium
212

Word Search II

Solve the Word Search II problem using backtracking with pruning to find all words on a board of characters.

Hard
213

House Robber II

Maximize your loot by robbing houses arranged in a circle without alerting the police using dynamic programming.

Medium
215

Kth Largest Element in an Array

Find the kth largest element in an unsorted array using optimal approaches like Quickselect or heaps.

Medium
216

Combination Sum III

Find all unique combinations of k numbers adding to n using efficient backtracking with pruning in arrays.

Medium
217

Contains Duplicate

Determine if an integer array contains any duplicate values by efficiently scanning with a hash lookup to ensure fast de…

Easy
218

The Skyline Problem

The Skyline Problem requires calculating a city's silhouette using array manipulation and divide-and-conquer techniques …

Hard
219

Contains Duplicate II

Check if any two equal numbers exist within k indices using array scanning and hash table lookup efficiently.

Easy
220

Contains Duplicate III

The problem involves finding a pair of indices in an array where the index and value differences are within given limits…

Hard
221

Maximal Square

Maximal Square is a matrix-based dynamic programming problem that focuses on finding the largest square filled with 1's.

Medium
228

Summary Ranges

Summary Ranges involves converting a sorted array of unique integers into a minimal list of range strings.

Easy
229

Majority Element II

Identify all elements in an integer array appearing more than ⌊ n/3 ⌋ times using efficient array scanning and hash coun…

Medium
238

Product of Array Except Self

Solve the 'Product of Array Except Self' problem by calculating the product of all elements except self for each index e…

Medium
239

Sliding Window Maximum

Solve the "Sliding Window Maximum" problem using efficient techniques like the sliding window, deque, and priority queue…

Hard
240

Search a 2D Matrix II

Efficiently search for a target in a 2D matrix using binary search and matrix properties.

Medium
260

Single Number III

Find the two unique numbers in an array where all other numbers appear exactly twice using bit manipulation efficiently.

Medium
268

Missing Number

Find the missing number in an array containing distinct numbers in the range [0, n].

Easy
274

H-Index

Determine a researcher's h-index by analyzing citations using array sorting and counting techniques efficiently and accu…

Medium
275

H-Index II

Compute a researcher's H-Index from a sorted citation array using binary search over the valid answer space efficiently.

Medium
283

Move Zeroes

Move all zeros in an array to the end while preserving the order of non-zero elements using efficient in-place operation…

Easy
284

Peeking Iterator

Design an iterator with peek functionality, adding to the standard next and hasNext operations for efficient element acc…

Medium
287

Find the Duplicate Number

The problem involves finding the duplicate number in an array of integers, using a binary search approach over the valid…

Medium
289

Game of Life

Solve the Game of Life by updating each cell based on its eight neighbors using Array and Matrix simulation patterns eff…

Medium
300

Longest Increasing Subsequence

Solve the Longest Increasing Subsequence problem using dynamic programming and binary search to efficiently find the sub…

Medium
303

Range Sum Query - Immutable

The Range Sum Query - Immutable problem involves implementing a data structure to handle range sum queries efficiently.

Easy
304

Range Sum Query 2D - Immutable

Design a 2D matrix class that efficiently handles sum queries with O(1) time complexity using a prefix sum approach.

Medium
307

Range Sum Query - Mutable

Implement a mutable range sum query using efficient design patterns to handle multiple updates and range sum queries.

Medium
309

Best Time to Buy and Sell Stock with Cooldown

Maximize stock profit with cooldown restrictions using state transition dynamic programming to track buy, sell, and cool…

Medium
312

Burst Balloons

Burst Balloons is a hard dynamic programming problem requiring careful state transitions to maximize coins collected eff…

Hard
313

Super Ugly Number

Compute the nth super ugly number efficiently using dynamic programming with state transitions based on the given prime …

Medium
315

Count of Smaller Numbers After Self

Solve the Count of Smaller Numbers After Self problem using binary search and optimized algorithms.

Hard
318

Maximum Product of Word Lengths

The problem requires finding the maximum product of lengths of two words from an array, where the words don't share comm…

Medium
321

Create Maximum Number

Create Maximum Number involves merging digits from two arrays while preserving order, maximizing the resulting number.

Hard
322

Coin Change

Find the minimum number of coins needed to reach a target amount using dynamic programming state transitions efficiently…

Medium
324

Wiggle Sort II

Rearrange an array in a way that every odd-indexed element is greater than its adjacent even-indexed elements.

Medium
327

Count of Range Sum

Count the number of subarray sums within a given inclusive range using optimized divide-and-conquer techniques efficient…

Hard
329

Longest Increasing Path in a Matrix

Find the length of the longest increasing path in a matrix with given movement constraints using graph techniques.

Hard
330

Patching Array

Patching Array requires adding the minimum numbers to cover all sums from 1 to n using greedy choices and invariant chec…

Hard
334

Increasing Triplet Subsequence

Identify if an array contains a strictly increasing triplet by maintaining a running minimal and middle value efficientl…

Medium
335

Self Crossing

Determine if a path defined by sequential distances on a 2D plane crosses itself using array and math reasoning.

Hard
336

Palindrome Pairs

Find all pairs of words in a list that form palindromes when concatenated using efficient scanning and hash mapping.

Hard
347

Top K Frequent Elements

Find the k most frequent elements from an array using efficient algorithms like hashing and sorting.

Medium
349

Intersection of Two Arrays

Find the intersection of two arrays while ensuring unique elements using efficient array scanning and hash lookups.

Easy
350

Intersection of Two Arrays II

Find the intersection of two arrays, accounting for multiple occurrences of the same number.

Easy
354

Russian Doll Envelopes

Russian Doll Envelopes is a dynamic programming problem that involves finding the longest chain of envelopes that can be…

Hard
363

Max Sum of Rectangle No Larger Than K

Solve the "Max Sum of Rectangle No Larger Than K" problem using binary search over the valid sum space to optimize space…

Hard
368

Largest Divisible Subset

Find the largest subset of distinct positive integers where every pair satisfies divisibility using state transition dyn…

Medium
373

Find K Pairs with Smallest Sums

Find K Pairs with Smallest Sums combines arrays and heap usage to select the smallest sum pairs efficiently.

Medium
376

Wiggle Subsequence

Find the longest wiggle subsequence in an integer array using state transition dynamic programming with greedy optimizat…

Medium
377

Combination Sum IV

Combination Sum IV asks to find the number of combinations that sum to a given target using elements from an array.

Medium
378

Kth Smallest Element in a Sorted Matrix

Find the kth smallest element in a sorted n x n matrix using efficient binary search or heap strategies for optimized me…

Medium
380

Insert Delete GetRandom O(1)

Implement a data structure supporting insert, delete, and getRandom in average O(1) using array plus hash mapping.

Medium
381

Insert Delete GetRandom O(1) - Duplicates allowed

This problem challenges you to design a data structure that supports insertion, removal, and random access with O(1) tim…

Hard
384

Shuffle an Array

Shuffle an Array requires designing a class to randomly permute an integer array while ensuring all permutations are equ…

Medium
391

Perfect Rectangle

Determine if given axis-aligned rectangles form a perfect cover using array scanning and hash-based corner counting tech…

Hard
393

UTF-8 Validation

Determine if an integer array represents valid UTF-8 encoding based on its byte sequences using bit manipulation.

Medium
396

Rotate Function

Maximize the rotation function by rotating the array and calculating the weighted sum for all rotations.

Medium
399

Evaluate Division

Compute the results of division queries from given equations using graph traversal and depth-first search efficiently.

Medium
403

Frog Jump

Determine if a frog can cross a river using jumps constrained by previous step sizes in a dynamic programming state tran…

Hard
406

Queue Reconstruction by Height

Reconstruct a queue based on the given heights and the number of taller people in front, using sorting and binary indexe…

Medium
407

Trapping Rain Water II

Solve Trapping Rain Water II using breadth-first search and priority queues for efficient water trapping in a matrix.

Hard
410

Split Array Largest Sum

Solve the 'Split Array Largest Sum' problem by minimizing the largest sum across k subarrays using dynamic programming a…

Hard
413

Arithmetic Slices

Count the number of arithmetic subarrays in a given integer array using dynamic programming.

Medium
414

Third Maximum Number

Find the third distinct maximum number in an array using array traversal and sorting techniques, handling duplicates car…

Easy
416

Partition Equal Subset Sum

Determine if an array can be partitioned into two subsets with equal sum using dynamic programming techniques.

Medium
417

Pacific Atlantic Water Flow

Find all cells on an island where water can flow to both the Pacific and Atlantic oceans using DFS or BFS.

Medium
419

Battleships in a Board

Count the number of non-overlapping battleships on a 2D board using array traversal and depth-first search patterns effi…

Medium
421

Maximum XOR of Two Numbers in an Array

Find the maximum XOR of two numbers in an integer array using efficient bit manipulation techniques.

Medium
427

Construct Quad Tree

Construct a Quad-Tree from a binary matrix by recursively subdividing regions and tracking uniform states efficiently.

Medium
435

Non-overlapping Intervals

Determine the minimum number of intervals to remove from a list to ensure no intervals overlap using dynamic programming…

Medium
442

Find All Duplicates in an Array

Find all integers that appear twice in an array with O(n) time and constant space complexity.

Medium
446

Arithmetic Slices II - Subsequence

Count all arithmetic subsequences in an array using dynamic programming with precise state transitions for correctness.

Hard
447

Number of Boomerangs

Compute all valid boomerang tuples in a point set using array scanning with hash maps to track distances efficiently.

Medium
448

Find All Numbers Disappeared in an Array

Identify all missing numbers in an array using efficient scanning and hash-based lookup for optimal performance.

Easy
452

Minimum Number of Arrows to Burst Balloons

Find the minimum number of arrows needed to burst all balloons by considering greedy choice and invariant validation.

Medium
453

Minimum Moves to Equal Array Elements

Compute the fewest steps to make all elements equal by incrementing n-1 array items, applying array and math reasoning.

Medium
454

4Sum II

Count all quadruples from four integer arrays that sum to zero using efficient array scanning and hash table lookups.

Medium
455

Assign Cookies

Maximize content children by assigning at most one cookie per child using two-pointer scanning and greedy sorting techni…

Easy
456

132 Pattern

Identify whether a given integer array contains a 132 pattern subsequence using efficient stack and search techniques.

Medium
457

Circular Array Loop

Detect whether a circular array contains a loop of consistent direction using efficient array scanning and hash lookup t…

Medium
462

Minimum Moves to Equal Array Elements II

Find the minimum moves to equalize all array elements using increments or decrements with array and math techniques.

Medium
463

Island Perimeter

Determine the perimeter of an island in a grid of land and water cells using DFS or BFS.

Easy
472

Concatenated Words

Find concatenated words by using dynamic programming and depth-first search to identify valid words made of other words …

Hard
473

Matchsticks to Square

The problem asks to determine if we can use matchsticks to form a square, exploring dynamic programming and backtracking…

Medium
474

Ones and Zeroes

Solve the Ones and Zeroes problem using dynamic programming with state transition, focusing on array and string manipula…

Medium
475

Heaters

Determine the minimum heater radius to cover all houses using a binary search over potential radius values efficiently.

Medium
477

Total Hamming Distance

Calculate the total Hamming distance between all pairs in an integer array using efficient bit manipulation techniques.

Medium
480

Sliding Window Median

Compute the median for each sliding window of size k in an array using efficient array scanning and hash lookup techniqu…

Hard
485

Max Consecutive Ones

Find the maximum sequence of consecutive 1s in a binary array using an efficient array-driven scanning approach.

Easy
486

Predict the Winner

Predict the Winner involves two players taking turns to maximize their score by picking from either end of an array, opt…

Medium
491

Non-decreasing Subsequences

Return all possible non-decreasing subsequences with at least two elements from the input array, nums.

Medium
493

Reverse Pairs

Count the number of reverse pairs in a given integer array using efficient algorithms like binary search and merge sort.

Hard
494

Target Sum

Target Sum requires counting all expressions from nums using '+' or '-' that evaluate exactly to the given target intege…

Medium
495

Teemo Attacking

Compute the total poisoned time Ashe experiences from Teemo's attacks using an array-based simulation approach efficient…

Easy
496

Next Greater Element I

Find the next greater element for each number in nums1 from the nums2 array using an optimized approach.

Easy
497

Random Point in Non-overlapping Rectangles

Design an algorithm to pick random points within non-overlapping rectangles using binary search and reservoir sampling.

Medium
498

Diagonal Traverse

Traverse a matrix diagonally and return all elements in the specific zig-zag order required by the problem pattern.

Medium
500

Keyboard Row

Identify all words from a list that can be typed using letters from only one row of a standard American keyboard.

Easy
502

IPO

Maximize total capital by selecting up to k projects, based on initial capital and project profits using a greedy strate…

Hard
503

Next Greater Element II

Solve the Next Greater Element II problem by using a stack-based state management approach for circular arrays.

Medium
506

Relative Ranks

Solve Relative Ranks by sorting scores with original indices, then writing medal labels or numeric places back in answer…

Easy
517

Super Washing Machines

Calculate the minimum moves to balance dresses across washing machines using a greedy strategy and invariant validation …

Hard
518

Coin Change II

Calculate the number of unique coin combinations to reach a target amount using state transition dynamic programming eff…

Medium
522

Longest Uncommon Subsequence II

Find the longest string in an array that is not a subsequence of any other string, using array scanning and hash checks …

Medium
523

Continuous Subarray Sum

Identify if any continuous subarray sums to a multiple of k using prefix sums and hash table tracking efficiently.

Medium
524

Longest Word in Dictionary through Deleting

Find the longest word in the dictionary that can be formed by deleting characters from a string, using two-pointer scann…

Medium
525

Contiguous Array

Find the maximum length contiguous subarray with equal numbers of 0s and 1s using array scanning and hash lookup efficie…

Medium
526

Beautiful Arrangement

The Beautiful Arrangement problem asks for the number of valid permutations of n integers satisfying specific divisibili…

Medium
528

Random Pick with Weight

Random Pick with Weight requires implementing a probabilistic index picker using prefix sums and binary search efficient…

Medium
529

Minesweeper

Solve the Minesweeper game by updating revealed squares and handling clicks with Depth-First Search and Array manipulati…

Medium
532

K-diff Pairs in an Array

Solve K-diff Pairs in an Array by counting unique differences with a hash map or sorted two-pointer sweep.

Medium
539

Minimum Time Difference

Calculate the smallest time difference between clock points using array manipulation and mathematical conversions effici…

Medium
540

Single Element in a Sorted Array

Find the single non-duplicate element in a sorted array where every other element appears exactly twice.

Medium
542

01 Matrix

The '01 Matrix' problem challenges you to find the nearest zero for each cell in a binary matrix using dynamic programmi…

Medium
546

Remove Boxes

Maximize points by strategically removing contiguous same-colored boxes using state transition dynamic programming and m…

Hard
553

Optimal Division

Maximize the value of an expression by optimally placing parentheses for division operations.

Medium
554

Brick Wall

Solve the Brick Wall problem using array scanning and hash lookups to minimize crossed bricks from a vertical line.

Medium
560

Subarray Sum Equals K

Count the total number of contiguous subarrays in an integer array that sum exactly to a target value k using optimized …

Medium
561

Array Partition

Maximize the sum of minimums of n pairs in a 2n integer array using a greedy pairing strategy efficiently.

Easy
565

Array Nesting

Find the longest nested set in a permutation array using a depth-first traversal, handling cycles efficiently for medium…

Medium
566

Reshape the Matrix

Reshape the Matrix involves transforming a 2D matrix into a new matrix with the same elements in row-major order, follow…

Easy
575

Distribute Candies

Maximize the number of different candies Alice can eat given a set of candies and constraints on quantity.

Easy
581

Shortest Unsorted Continuous Subarray

Find the shortest unsorted continuous subarray that, if sorted, would sort the entire array.

Medium
587

Erect the Fence

Find the perimeter fence of a garden by determining the outermost trees in a set of given tree coordinates.

Hard
594

Longest Harmonious Subsequence

Find the length of the longest harmonious subsequence in an integer array using array scanning and hash-based frequency …

Easy
598

Range Addition II

Range Addition II requires counting maximum values in a matrix after incremental operations using array and math reasoni…

Easy
599

Minimum Index Sum of Two Lists

Find the common strings between two lists with the smallest index sum in this easy problem involving array scanning and …

Easy
605

Can Place Flowers

Determine if n new flowers can be planted in a flowerbed, ensuring no adjacent flowers using a greedy approach.

Easy
609

Find Duplicate File in System

Find and return duplicate files in the file system, grouping them by their paths and contents using an array scanning ap…

Medium
611

Valid Triangle Number

Count all triplets in an integer array that satisfy the triangle inequality to form valid triangles efficiently using so…

Medium
621

Task Scheduler

Task Scheduler is solved by counting task frequencies and computing how cooldown gaps force idle slots around the most f…

Medium
622

Design Circular Queue

Design a circular queue that allows efficient FIFO operations using linked-list pointer manipulation to optimize space u…

Medium
624

Maximum Distance in Arrays

Maximum Distance in Arrays uses a greedy running minimum and maximum from previous arrays to validate cross array distan…

Medium
628

Maximum Product of Three Numbers

Find three numbers in an array whose product is the largest using sorting and careful handling of negative values.

Easy
630

Course Schedule III

Solve the 'Course Schedule III' problem with a greedy approach involving course selection and validation of constraints.

Hard
632

Smallest Range Covering Elements from K Lists

Find the minimal range covering at least one number from each of k sorted lists using array scanning and hash lookup eff…

Hard
636

Exclusive Time of Functions

Solve the 'Exclusive Time of Functions' problem using stack-based state management for accurate function execution time …

Medium
638

Shopping Offers

Minimize the cost of purchasing items using available special offers with state transition dynamic programming.

Medium
641

Design Circular Deque

Design and implement a circular deque using linked-list pointer manipulation, ensuring efficient insertion and deletion …

Medium
643

Maximum Average Subarray I

Find the maximum average of any contiguous subarray of length k in a given integer array using a sliding window approach…

Easy
645

Set Mismatch

Identify the duplicated and missing numbers in an integer array using array scanning combined with hash table lookup eff…

Easy
646

Maximum Length of Pair Chain

Determine the maximum length of a chain formed by pairs using dynamic programming and greedy sorting techniques efficien…

Medium
648

Replace Words

Replace words in a sentence using the shortest root from a dictionary, applying efficient array scanning and hash lookup…

Medium
654

Maximum Binary Tree

Construct a maximum binary tree by recursively selecting the largest element and dividing the array into left and right …

Medium
658

Find K Closest Elements

Identify the k integers closest to a target x in a sorted array using binary search and two-pointer strategies efficient…

Medium
659

Split Array into Consecutive Subsequences

Verify if it's possible to split a sorted array into consecutive subsequences of length 3 or more.

Medium
661

Image Smoother

Apply a 3x3 smoothing filter to a matrix, rounding down each cell average including surrounding neighbors for accurate r…

Easy
665

Non-decreasing Array

Check if an array can become non-decreasing by modifying at most one element using an array-driven solution strategy.

Medium
667

Beautiful Arrangement II

Construct a beautiful arrangement of integers from 1 to n with k distinct integers, optimizing for time and space effici…

Medium
673

Number of Longest Increasing Subsequence

This problem challenges you to find the number of longest increasing subsequences in a given array of integers.

Medium
674

Longest Continuous Increasing Subsequence

Find the length of the longest continuous increasing subsequence in an unsorted integer array using an array-driven solu…

Easy
675

Cut Off Trees for Golf Event

Determine the minimum steps to cut all trees in a forest matrix in ascending height order using BFS traversal and priori…

Hard
679

24 Game

Solve the 24 Game by arranging four card numbers using arithmetic operators and parentheses to reach exactly 24 efficien…

Hard
682

Baseball Game

Simulate baseball score operations using a stack-based approach to compute the final score after all operations.

Easy
689

Maximum Sum of 3 Non-Overlapping Subarrays

Maximize the sum of three non-overlapping subarrays with length k in an integer array using dynamic programming.

Hard
690

Employee Importance

Calculate an employee's total importance including all direct and indirect subordinates using array scanning and hash lo…

Medium
691

Stickers to Spell Word

Determine the minimum number of stickers needed to spell a target word using array scanning and hash lookups for efficie…

Hard
692

Top K Frequent Words

Solve Top K Frequent Words by counting each word, then ordering ties alphabetically so frequency wins before lexicograph…

Medium
695

Max Area of Island

Find the largest connected land area in a binary grid using array traversal and depth-first search efficiently.

Medium
697

Degree of an Array

Find the shortest subarray with the same degree as the given array using efficient array scanning and hash lookups.

Easy
698

Partition to K Equal Sum Subsets

Determine if an integer array can be partitioned into k subsets where each subset sums to the same value using DP and ba…

Medium
699

Falling Squares

Solve Falling Squares by efficiently computing maximum stack heights using arrays with segment tree optimization techniq…

Hard
704

Binary Search

Solve the Binary Search problem by finding the index of a target value in a sorted array with O(log n) complexity.

Easy
705

Design HashSet

Implement a custom HashSet without built-in libraries using array scanning and hash lookup for efficient membership chec…

Easy
706

Design HashMap

Implement a custom HashMap from scratch using array scanning and hash lookup without built-in libraries for efficient ke…

Easy
710

Random Pick with Blacklist

Random Pick with Blacklist requires designing a method to uniformly pick integers while excluding blacklisted values eff…

Hard
713

Subarray Product Less Than K

Count subarrays with a product strictly less than a given value k using efficient algorithms like binary search and slid…

Medium
714

Best Time to Buy and Sell Stock with Transaction Fee

Maximize stock trading profits accounting for per-transaction fees using state transition dynamic programming and greedy…

Medium
717

1-bit and 2-bit Characters

Determine whether the last character in a binary array represents a one-bit character or a two-bit character.

Easy
718

Maximum Length of Repeated Subarray

Find the maximum length of a subarray that appears in both given integer arrays using dynamic programming.

Medium
719

Find K-th Smallest Pair Distance

Solve Find K-th Smallest Pair Distance by sorting nums, then binary searching the distance and counting valid pairs with…

Hard
720

Longest Word in Dictionary

Find the longest word in a dictionary that can be built one character at a time from other words in the dictionary.

Medium
721

Accounts Merge

Merge accounts by connecting emails and returning each user's sorted email list using array scanning and hash lookup eff…

Medium
722

Remove Comments

Remove comments from a given C++ program source array, handling line and block comments.

Medium
724

Find Pivot Index

Find the pivot index in an array where the sums of elements on both sides are equal using array and prefix sum technique…

Easy
729

My Calendar I

Implement a calendar supporting non-overlapping event bookings using binary search for efficient insertion and conflict …

Medium
731

My Calendar II

Implement a calendar that allows double bookings but prevents triple bookings, managing overlapping intervals efficientl…

Medium
733

Flood Fill

Flood Fill is an array and DFS problem where you change connected pixels to a target color efficiently using recursion o…

Easy
735

Asteroid Collision

Determine the final positions of moving asteroids using a stack-based simulation for efficient collision resolution in l…

Medium
739

Daily Temperatures

In the Daily Temperatures problem, you need to find out how many days to wait for a warmer temperature based on given da…

Medium
740

Delete and Earn

Maximize points by deleting numbers from an array while removing all adjacent values, using dynamic programming efficien…

Medium
741

Cherry Pickup

Maximize cherries collected on a grid, employing state transition dynamic programming with careful navigation across obs…

Hard
744

Find Smallest Letter Greater Than Target

Locate the smallest character in a sorted array that is strictly greater than a given target using efficient binary sear…

Easy
745

Prefix and Suffix Search

Design a dictionary to search words by both prefix and suffix using a Trie structure and hash lookups.

Hard
746

Min Cost Climbing Stairs

Compute the minimum cost to reach the top of a staircase using dynamic programming and step-by-step state transitions ef…

Easy
747

Largest Number At Least Twice of Others

Determine if the largest number in the array is at least twice as large as every other element, and return its index or …

Easy
748

Shortest Completing Word

Find the shortest word that completes the license plate by matching all required letters, considering frequency and case…

Easy
749

Contain Virus

Contain Virus involves using array-based Depth-First Search to contain viral spread by building walls around infected re…

Hard
752

Open the Lock

Solve the Open the Lock problem using array scanning plus hash lookup to efficiently find the shortest unlock sequence.

Medium
757

Set Intersection Size At Least Two

Solve the Set Intersection Size At Least Two problem using a greedy approach and invariant validation.

Hard
764

Largest Plus Sign

Find the largest axis-aligned plus sign in a binary grid with some mines using dynamic programming.

Medium
766

Toeplitz Matrix

Determine if a given matrix is a Toeplitz matrix by checking diagonal consistency.

Easy
768

Max Chunks To Make Sorted II

Determine the maximum number of chunks you can split an array into so that sorting each chunk results in a fully sorted …

Hard
769

Max Chunks To Make Sorted

The Max Chunks To Make Sorted problem requires you to split an array into the maximum number of chunks that can be sorte…

Medium
773

Sliding Puzzle

Determine the minimum moves to solve a 2x3 sliding puzzle using BFS and state transition dynamic programming techniques …

Hard
775

Global and Local Inversions

Determine if every global inversion in a permutation array is also a local inversion using array and math logic efficien…

Medium
778

Swim in Rising Water

Solve the problem of swimming through a grid of rising water with a binary search on the valid answer space.

Hard
781

Rabbits in Forest

Solve Rabbits in Forest by grouping equal answers and rounding each group into the smallest valid color-class size.

Medium
782

Transform to Chessboard

Determine the minimum swaps of rows or columns to convert an n x n binary board into a valid chessboard configuration.

Hard
786

K-th Smallest Prime Fraction

Find the k-th smallest fraction from a sorted array of unique primes using a binary search over the answer space.

Medium
789

Escape The Ghosts

Escape The Ghosts tests your ability to analyze movements in an infinite grid while racing against ghost positions using…

Medium
792

Number of Matching Subsequences

Given a string s and a list of words, count how many words are subsequences of s using efficient array scanning and hash…

Medium
794

Valid Tic-Tac-Toe State

Verify if a given Tic-Tac-Toe board can represent a valid game state during a valid sequence of moves.

Medium
795

Number of Subarrays with Bounded Maximum

Count the number of contiguous subarrays with a bounded maximum value using a two-pointer approach.

Medium
798

Smallest Rotation with Highest Score

Find the smallest rotation index with the highest score using array and prefix sum techniques.

Hard
801

Minimum Swaps To Make Sequences Increasing

This problem involves finding the minimum number of swaps needed to make two sequences strictly increasing using dynamic…

Hard
803

Bricks Falling When Hit

Bricks Falling When Hit challenges your ability to simulate brick falls after sequential erasures using Union Find.

Hard
804

Unique Morse Code Words

Determine how many unique Morse code transformations can be generated from a list of words using a hash table and array …

Easy
805

Split Array With Same Average

Determine whether an integer array can be partitioned into two non-empty subarrays with the same average using dynamic p…

Hard
806

Number of Lines To Write String

Calculate how many lines are needed to write a string given individual letter widths, constrained to 100 pixels per line…

Easy
807

Max Increase to Keep City Skyline

Maximize building heights in a city grid without changing the skyline, using greedy selection constrained by row and col…

Medium
809

Expressive Words

Expressive Words challenges you to determine if a word can be transformed into a given string by extending groups of rep…

Medium
810

Chalkboard XOR Game

The Chalkboard XOR Game is a game theory problem involving array manipulation and bitwise XOR, where players alternate e…

Hard
811

Subdomain Visit Count

The Subdomain Visit Count problem requires counting the visits to all subdomains of a given domain from a list of count-…

Medium
812

Largest Triangle Area

Find the area of the largest triangle formed by three distinct points on a 2D plane.

Easy
813

Largest Sum of Averages

Maximize the sum of averages by partitioning an integer array into at most k contiguous subarrays using dynamic programm…

Medium
815

Bus Routes

Bus Routes is solved by BFS over buses and stops, using stop-to-route hashing to avoid expensive repeated route scans.

Hard
817

Linked List Components

Count the number of connected components in a linked list subset using array scanning and hash table lookups efficiently…

Medium
819

Most Common Word

Find the most frequent non-banned word in a paragraph, excluding punctuation, using an efficient array scan and hash tab…

Easy
820

Short Encoding of Words

Find the minimum length of a reference string encoding an array of words using array scanning and hash lookup efficientl…

Medium
821

Shortest Distance to a Character

Compute the minimum distance from each character in a string to a target character using efficient scanning techniques.

Easy
822

Card Flipping Game

The Card Flipping Game problem asks for the smallest integer that can be facing down but not up after flipping cards.

Medium
823

Binary Trees With Factors

Given an array of integers, find how many binary trees can be formed such that non-leaf nodes' values are the product of…

Medium
825

Friends Of Appropriate Ages

The Friends Of Appropriate Ages problem involves counting valid friend requests between people based on their ages with …

Medium
826

Most Profit Assigning Work

Assign workers to jobs maximizing total profit using difficulty, profit, and worker arrays efficiently with binary searc…

Medium
827

Making A Large Island

Calculate the largest island size by converting at most one zero in a binary grid using array and DFS techniques efficie…

Hard
832

Flipping an Image

Flip each row of a binary matrix horizontally and invert its values efficiently using a two-pointer scanning approach.

Easy
833

Find And Replace in String

This problem challenges you to perform multiple string replacements at specific indices using a pattern involving array …

Medium
835

Image Overlap

Image Overlap requires calculating the overlap between two binary matrices by translating one image over the other.

Medium
839

Similar String Groups

Determine the number of connected groups of similar strings by swapping at most two letters using array scanning and has…

Hard
840

Magic Squares In Grid

Scan every 3x3 window, reject invalid digits fast, then verify row, column, and diagonal sums for Magic Squares In Grid.

Medium
843

Guess the Word

Master the Guess the Word problem by applying array manipulation, match-counting math, and strategic interactive guessin…

Hard
845

Longest Mountain in Array

Find the length of the longest subarray forming a mountain pattern using state transitions and two-pointer logic efficie…

Medium
846

Hand of Straights

Check if a hand of cards can be rearranged into groups of consecutive values.

Medium
848

Shifting Letters

Given a string and a shift array, shift the first i+1 letters of the string as specified in the array.

Medium
849

Maximize Distance to Closest Person

Determine the seat placement that maximizes distance to the nearest person using a linear array scan strategy efficientl…

Medium
850

Rectangle Area II

The problem involves calculating the total area covered by multiple rectangles, ensuring overlap is counted only once.

Hard
851

Loud and Rich

Determine the quietest person richer than each individual using graph indegree analysis and topological ordering techniq…

Medium
852

Peak Index in a Mountain Array

Find the peak index in a mountain array using binary search for efficient O(log n) time complexity.

Medium
853

Car Fleet

The Car Fleet problem asks how many car fleets will reach a target given their starting positions and speeds, considerin…

Medium
857

Minimum Cost to Hire K Workers

Find the minimum cost to hire exactly k workers based on quality and wage expectations in this challenging greedy proble…

Hard
860

Lemonade Change

Determine if you can provide exact change to every customer at a lemonade stand using greedy bill management techniques.

Easy
861

Score After Flipping Matrix

Maximize the score of a binary matrix by flipping rows and columns using a greedy approach and validation of invariants.

Medium
862

Shortest Subarray with Sum at Least K

Find the shortest subarray with a sum of at least k using binary search and sliding window techniques.

Hard
864

Shortest Path to Get All Keys

Find the minimum steps to collect all keys in a grid using BFS and bitmasking, handling locks efficiently.

Hard
867

Transpose Matrix

Transpose Matrix problem requires flipping a matrix's rows and columns to return the transposed version.

Easy
870

Advantage Shuffle

Maximize the advantage of nums1 over nums2 using a two-pointer greedy strategy, carefully tracking which elements beat o…

Medium
871

Minimum Number of Refueling Stops

Determine the minimum number of refueling stops needed to reach a target using dynamic programming and greedy strategies…

Hard
873

Length of Longest Fibonacci Subsequence

Find the length of the longest Fibonacci-like subsequence from a strictly increasing array of integers.

Medium
874

Walking Robot Simulation

The Walking Robot Simulation problem involves moving a robot in an infinite grid and calculating its furthest distance f…

Medium
875

Koko Eating Bananas

Koko Eating Bananas challenges you to find the minimum eating speed to finish piles of bananas in a given time using bin…

Medium
877

Stone Game

Stone Game is a dynamic programming problem where players alternate taking stones from piles to maximize their score.

Medium
879

Profitable Schemes

Given a group of members and a list of crimes, count the profitable schemes that meet the profit and group constraints.

Hard
881

Boats to Save People

Find the minimum number of boats required to save all people, using a two-pointer approach for efficient pairing.

Medium
883

Projection Area of 3D Shapes

Calculate the projection area of a 3D shape defined by a grid of towers with varying heights.

Easy
885

Spiral Matrix III

Solve the Spiral Matrix III problem by simulating the movement across a matrix with specific constraints on direction an…

Medium
888

Fair Candy Swap

Determine which single candy box Alice and Bob should swap to equalize their total candies using array scanning and hash…

Easy
889

Construct Binary Tree from Preorder and Postorder Traversal

Reconstruct a binary tree from preorder and postorder traversals using array scanning and hash lookup.

Medium
890

Find and Replace Pattern

Identify all words matching a given pattern by checking consistent letter mappings using hash tables and array scanning …

Medium
891

Sum of Subsequence Widths

Calculate the sum of widths for all subsequences in an integer array using sorting and combinatorial math efficiently.

Hard
892

Surface Area of 3D Shapes

Solve the Surface Area of 3D Shapes problem using array manipulation and mathematical formulas to calculate surface area…

Easy
893

Groups of Special-Equivalent Strings

Determine the number of special-equivalent string groups using character swaps at even or odd indices efficiently.

Medium
896

Monotonic Array

Determine if an integer array is entirely monotone increasing or decreasing using a clear array-driven approach.

Easy
898

Bitwise ORs of Subarrays

Compute the number of unique bitwise OR values from all non-empty subarrays using dynamic state transitions efficiently.

Medium
900

RLE Iterator

Design an efficient iterator for a run-length encoded array, handling large counts and sequential access correctly every…

Medium
902

Numbers At Most N Given Digit Set

The 'Numbers At Most N Given Digit Set' problem requires calculating how many numbers can be formed using a given digit …

Hard
904

Fruit Into Baskets

The Fruit Into Baskets problem requires finding the maximum number of fruits you can pick from a row of trees under spec…

Medium
905

Sort Array By Parity

Reorder an integer array so all even numbers come before odd numbers using a precise two-pointer scanning method.

Easy
907

Sum of Subarray Minimums

Calculate the sum of minimum values across all subarrays of a given array modulo 10^9 + 7.

Medium
908

Smallest Range I

Find the smallest score of an array after applying an operation to each element within a given range.

Easy
909

Snakes and Ladders

Solve the Snakes and Ladders problem using a BFS strategy to efficiently navigate the board and reach the final square.

Medium
910

Smallest Range II

Determine the minimum possible difference between the largest and smallest numbers after adjusting each by plus or minus…

Medium
911

Online Election

Solve the Online Election problem by implementing a class that tracks votes and queries the leading candidate at any giv…

Medium
912

Sort an Array

Sort an array using an optimal algorithm, focusing on time and space complexity considerations.

Medium
914

X of a Kind in a Deck of Cards

Solve the problem of determining if a deck can be partitioned into groups with equal occurrences of card values.

Easy
915

Partition Array into Disjoint Intervals

Partition the array into two subarrays such that the left contains the smallest possible elements and the right contains…

Medium
916

Word Subsets

Word Subsets is solved by merging words2 into one max-frequency requirement, then scanning words1 against that fixed let…

Medium
918

Maximum Sum Circular Subarray

Find the maximum sum of a circular subarray using state transition dynamic programming, optimizing for wraparound cases …

Medium
922

Sort Array By Parity II

Sort an array where even numbers appear at even indices and odd numbers appear at odd indices using two-pointer scanning…

Easy
923

3Sum With Multiplicity

Count all unique triplets in an integer array whose sum equals the target, handling multiplicity efficiently using hashi…

Medium
924

Minimize Malware Spread

Identify which single infected node to remove to minimize total malware spread in a connected network graph efficiently.

Hard
927

Three Equal Parts

Divide a binary array into three contiguous parts such that each part represents the same integer value in binary, using…

Hard
928

Minimize Malware Spread II

Minimize Malware Spread II asks to minimize the spread of malware in a network of nodes by removing one infected node.

Hard
929

Unique Email Addresses

Identify the count of unique email addresses by normalizing local names and using hash-based lookups efficiently.

Easy
930

Binary Subarrays With Sum

Count all contiguous subarrays in a binary array whose elements sum exactly to a given goal using prefix sums efficientl…

Medium
931

Minimum Falling Path Sum

Minimum Falling Path Sum is a matrix dynamic programming problem where each cell depends on three reachable cells above …

Medium
932

Beautiful Array

Beautiful Array builds a valid permutation by recursively separating odd and even positions so no middle-average triple …

Medium
934

Shortest Bridge

Find the minimum flips to connect two separate islands in a binary matrix using Array and DFS techniques efficiently.

Medium
937

Reorder Data in Log Files

Reorder Data in Log Files requires sorting letter-logs lexicographically while keeping digit-logs in original order for …

Medium
939

Minimum Area Rectangle

Find the minimum area of a rectangle formed by given points on a 2D plane with sides parallel to axes.

Medium
941

Valid Mountain Array

The 'Valid Mountain Array' problem requires determining if an array meets the conditions of a valid mountain array using…

Easy
942

DI String Match

Reconstruct a permutation from a DI string using two-pointer scanning, carefully tracking the increasing and decreasing …

Easy
943

Find the Shortest Superstring

This problem requires constructing the shortest string containing all input words using state transition dynamic program…

Hard
944

Delete Columns to Make Sorted

The 'Delete Columns to Make Sorted' problem asks to remove unsorted columns from a string array, ensuring all columns ar…

Easy
945

Minimum Increment to Make Array Unique

This problem challenges you to find the minimum moves to make all elements in an array unique by incrementing elements.

Medium
946

Validate Stack Sequences

Determine if a sequence of push and pop operations can produce the given popped array using a stack-based state approach…

Medium
948

Bag of Tokens

Maximize your score in the Bag of Tokens problem by strategically playing tokens with two-pointer scanning and greedy te…

Medium
949

Largest Time for Given Digits

Given four digits, determine the latest valid 24-hour time possible using each digit exactly once with backtracking.

Medium
950

Reveal Cards In Increasing Order

Determine the initial deck order to reveal cards in strictly increasing order using queue-driven simulation logic.

Medium
952

Largest Component Size by Common Factor

Find the largest connected component in an array where edges exist between numbers sharing a common factor greater than …

Hard
953

Verifying an Alien Dictionary

Verify if a sequence of words is sorted according to an alien language's custom alphabet order using array scanning and …

Easy
954

Array of Doubled Pairs

Given an array of even length, check if it can be reordered to satisfy a specific doubling condition.

Medium
955

Delete Columns to Make Sorted II

Solve the "Delete Columns to Make Sorted II" problem by applying greedy choices and invariant validation to string array…

Medium
956

Tallest Billboard

Solve the Tallest Billboard problem by using dynamic programming to find the maximum equal height for two disjoint rod s…

Hard
957

Prison Cells After N Days

Determine the state of 8 prison cells after N days using array scanning and cycle detection for repeated patterns effici…

Medium
959

Regions Cut By Slashes

Determine the number of regions in a grid divided by slashes using array scanning and union-find techniques efficiently.

Medium
960

Delete Columns to Make Sorted III

The problem requires minimizing deletions to ensure all strings are lexicographically sorted. Use dynamic programming fo…

Hard
961

N-Repeated Element in Size 2N Array

Find the element that is repeated exactly N times in a 2N-sized array using array scanning and hash lookups.

Easy
962

Maximum Width Ramp

Find the maximum width of a ramp where nums[i] <= nums[j] for i < j using a two-pointer approach.

Medium
963

Minimum Area Rectangle II

Find the minimum area rectangle from given points in the X-Y plane, with sides not necessarily parallel to the axes.

Medium
966

Vowel Spellchecker

Implement a spellchecker that matches queries to a wordlist using exact, case-insensitive, and vowel-error rules efficie…

Medium
969

Pancake Sorting

Sort an array using pancake flips, leveraging two-pointer scanning and invariant tracking to iteratively position the la…

Medium
973

K Closest Points to Origin

Find the k closest points to the origin in a 2D plane using array operations and Euclidean distance calculations efficie…

Medium
974

Subarray Sums Divisible by K

Count the number of subarrays whose sum is divisible by a given integer k using array scanning and hash lookup.

Medium
975

Odd Even Jump

Determine the number of valid starting indices in an array where you can reach the end with alternating odd and even jum…

Hard
976

Largest Perimeter Triangle

Given an integer array, find the largest perimeter of a triangle formed from three of these lengths.

Easy
977

Squares of a Sorted Array

The problem involves squaring elements of a sorted array and returning the squares in non-decreasing order.

Easy
978

Longest Turbulent Subarray

Find the length of the longest subarray where element comparisons alternate, using state transition dynamic programming …

Medium
980

Unique Paths III

Solve the Unique Paths III problem using backtracking search with pruning to count 4-directional paths covering all empt…

Hard
982

Triples with Bitwise AND Equal To Zero

Count all index triples in an array where the bitwise AND of their elements equals zero using efficient bit manipulation…

Hard
983

Minimum Cost For Tickets

Solve the Minimum Cost For Tickets problem using state transition dynamic programming for optimal travel ticket purchase…

Medium
985

Sum of Even Numbers After Queries

Efficiently update an integer array based on queries and compute the sum of even numbers after each modification using s…

Medium
986

Interval List Intersections

This problem requires finding the intersection of two lists of intervals using a two-pointer technique with invariant tr…

Medium
989

Add to Array-Form of Integer

Compute the sum of an integer and a number represented as an array, efficiently handling digit carries and array travers…

Easy
990

Satisfiability of Equality Equations

Determine if it's possible to assign values to variables such that all equations are satisfied based on equality and ine…

Medium
992

Subarrays with K Different Integers

Find subarrays with exactly k distinct integers in an integer array using sliding window and hash lookup techniques.

Hard
994

Rotting Oranges

Given a grid with fresh and rotten oranges, return the minimum time for all oranges to rot or -1 if impossible.

Medium
995

Minimum Number of K Consecutive Bit Flips

Determine the minimum number of k-length consecutive bit flips needed to convert all zeros to ones in a binary array eff…

Hard
996

Number of Squareful Arrays

Count the number of squareful arrays from the given list of integers by checking adjacent pairs' sums for perfect square…

Hard
997

Find the Town Judge

Find the Town Judge is an easy LeetCode problem that challenges you to identify a town judge from trust relationships us…

Easy
999

Available Captures for Rook

This problem involves finding the number of pawns a rook can capture on a chessboard, considering obstacles like bishops…

Easy
1000

Minimum Cost to Merge Stones

Minimize the cost to merge stones with k consecutive piles using dynamic programming to achieve the optimal solution.

Hard
1001

Grid Illumination

Grid Illumination uses an array scanning approach with hash lookups to check illuminated cells in a large grid based on …

Hard
1002

Find Common Characters

Return an array of common characters from all strings in the given list of words, including duplicates.

Easy
1004

Max Consecutive Ones III

Find the longest consecutive ones in a binary array by optimally flipping at most k zeros using sliding window technique…

Medium
1005

Maximize Sum Of Array After K Negations

Maximize the sum of an integer array after exactly k negations using a greedy approach and invariant tracking for optima…

Easy
1007

Minimum Domino Rotations For Equal Row

Minimize domino rotations to make either row identical in the problem of Minimum Domino Rotations For Equal Row.

Medium
1008

Construct Binary Search Tree from Preorder Traversal

Construct a binary search tree directly from a preorder traversal array using stack-based state tracking efficiently.

Medium
1010

Pairs of Songs With Total Durations Divisible by 60

Calculate the number of song pairs whose total durations sum to a multiple of 60 using array scanning and hash lookups.

Medium
1011

Capacity To Ship Packages Within D Days

Find the minimum ship capacity needed to ship all packages within D days, ensuring the cargo is shipped in the given ord…

Medium
1013

Partition Array Into Three Parts With Equal Sum

Determine if an array can be partitioned into three non-empty parts with equal sum using greedy choice and validation.

Easy
1014

Best Sightseeing Pair

Compute the maximum sightseeing score efficiently using state transition dynamic programming and single-pass array itera…

Medium
1018

Binary Prefix Divisible By 5

Determine which binary prefixes of a given array are divisible by 5 using bit manipulation for efficient checks.

Easy
1019

Next Greater Node In Linked List

Find the next greater value for each node in a linked list using monotonic stack techniques for efficient traversal.

Medium
1020

Number of Enclaves

This problem involves finding the number of land cells that cannot reach the boundary in a grid using DFS and array mani…

Medium
1023

Camelcase Matching

Camelcase Matching is a medium difficulty problem where you match queries to a given pattern by inserting lowercase lett…

Medium
1024

Video Stitching

Solve the "Video Stitching" problem using state transition dynamic programming to cover a sporting event with minimum cl…

Medium
1027

Longest Arithmetic Subsequence

Find the length of the longest arithmetic subsequence in a given integer array using scanning and hash-based lookup.

Medium
1029

Two City Scheduling

Two City Scheduling requires selecting optimal city assignments for 2n people to minimize total travel costs efficiently…

Medium
1030

Matrix Cells in Distance Order

Compute all matrix cell coordinates sorted by Manhattan distance from a given center using array and math techniques eff…

Easy
1031

Maximum Sum of Two Non-Overlapping Subarrays

Find the maximum sum of two non-overlapping subarrays by efficiently using state transition dynamic programming.

Medium
1032

Stream of Characters

Implement a StreamChecker that detects if any suffix of a character stream matches a given list of words using efficient…

Hard
1034

Coloring A Border

Given a grid and a starting cell, color all border cells of the connected component using DFS while preserving interior …

Medium
1035

Uncrossed Lines

The Uncrossed Lines problem involves finding the maximum number of non-intersecting lines that can be drawn between two …

Medium
1036

Escape a Large Maze

The 'Escape a Large Maze' problem involves navigating a massive grid with blocked squares and finding if a target can be…

Hard
1037

Valid Boomerang

Determine if three points on a 2D plane form a boomerang, based on distinctness and non-collinearity.

Easy
1039

Minimum Score Triangulation of Polygon

Compute the minimum total score to triangulate a convex polygon using state transition dynamic programming on vertex val…

Medium
1040

Moving Stones Until Consecutive II

Determine the minimum and maximum moves to make stones consecutive using sliding window and endpoint adjustments efficie…

Medium
1043

Partition Array for Maximum Sum

Partition an array into subarrays of length at most k, replacing each with its maximum to maximize total sum efficiently…

Medium
1046

Last Stone Weight

In the 'Last Stone Weight' problem, we smash the two heaviest stones until one remains, using heaps or sorting.

Easy
1048

Longest String Chain

Find the longest word chain by scanning arrays and using hash lookups to efficiently track predecessor-successor sequenc…

Medium
1049

Last Stone Weight II

In the 'Last Stone Weight II' problem, you need to find the minimal possible stone weight after a series of smashes usin…

Medium
1051

Height Checker

Determine how many students are out of place in a line by comparing their heights to the sorted expected order efficient…

Easy
1052

Grumpy Bookstore Owner

Maximize satisfied customers in a bookstore by strategically suppressing the owner's grumpy minutes using a sliding wind…

Medium
1053

Previous Permutation With One Swap

Find the lexicographically largest permutation smaller than the given array using exactly one swap, leveraging a greedy …

Medium
1054

Distant Barcodes

Rearrange barcodes in an array so that no two adjacent elements are equal, using a greedy approach and hash table for ef…

Medium
1072

Flip Columns For Maximum Number of Equal Rows

Maximize the number of equal rows in a binary matrix by flipping any number of columns.

Medium
1073

Adding Two Negabinary Numbers

Add two numbers represented in negabinary format and return the result in the same format.

Medium
1074

Number of Submatrices That Sum to Target

Count all non-empty submatrices in a given matrix whose elements sum exactly to the target using efficient scanning tech…

Hard
1089

Duplicate Zeros

Duplicate each zero in a fixed-length array in place, shifting elements right using a two-pointer scanning approach effi…

Easy
1090

Largest Values From Labels

Maximize the sum of selected item values while respecting label use limits using array scanning and hash tracking.

Medium
1091

Shortest Path in Binary Matrix

Find the shortest clear path in a binary matrix using BFS, carefully handling obstacles and diagonal movements for effic…

Medium
1093

Statistics from a Large Sample

Calculate minimum, maximum, mean, median, and mode from a large sample represented by an array of counts.

Medium
1094

Car Pooling

Determine if a car can handle multiple trips without exceeding its capacity using array sorting and event simulation tec…

Medium
1095

Find in Mountain Array

Find in Mountain Array requires locating a target using binary search over a peak-structured array efficiently in intera…

Hard
1105

Filling Bookcase Shelves

Determine the minimum total height of a bookcase by placing books in order using state transition dynamic programming.

Medium
1109

Corporate Flight Bookings

Solve Corporate Flight Bookings by marking range changes once, then building final seat totals with a single prefix sum …

Medium
1110

Delete Nodes And Return Forest

Delete nodes from a binary tree using array scanning and hash lookup to return the remaining forest efficiently.

Medium
1122

Relative Sort Array

Sort arr1 by the relative order of arr2, with remaining elements placed in ascending order.

Easy
1124

Longest Well-Performing Interval

The Longest Well-Performing Interval problem challenges you to find the longest subarray where tiring days exceed non-ti…

Medium
1125

Smallest Sufficient Team

Find the smallest subset of people covering all required skills using bitmask dynamic programming for efficient state tr…

Hard
1128

Number of Equivalent Domino Pairs

Count all pairs of dominoes that are equivalent by scanning the array and using a hash table for fast lookup.

Easy
1130

Minimum Cost Tree From Leaf Values

Compute the minimum sum of non-leaf nodes in a binary tree formed from array leaves using dynamic programming efficientl…

Medium
1131

Maximum of Absolute Value Expression

Calculate the largest sum of absolute differences across two arrays and their indices using an efficient pattern-based a…

Medium
1139

Largest 1-Bordered Square

Find the largest square of 1s with 1s on its borders in a binary grid using dynamic programming.

Medium
1140

Stone Game II

Stone Game II is a dynamic programming problem where Alice and Bob alternate taking stones from piles to maximize their …

Medium
1144

Decrease Elements To Make Array Zigzag

Transform any integer array into a zigzag pattern with minimal decrements using a targeted greedy approach and invariant…

Medium
1146

Snapshot Array

Implement a SnapshotArray that efficiently tracks element changes and retrieves past states using array scanning and has…

Medium
1157

Online Majority Element In Subarray

Efficiently find the majority element in any subarray using a data structure optimized for multiple range queries.

Hard
1160

Find Words That Can Be Formed by Characters

Compute the total length of words that can be fully constructed from given characters using array scanning and hash mapp…

Easy
1162

As Far from Land as Possible

Find the farthest water cell from land in a grid and return the Manhattan distance using state transition dynamic progra…

Medium
1169

Invalid Transactions

Detect invalid transactions by scanning arrays and cross-checking with hash tables for time, amount, and city conflicts …

Medium
1170

Compare Strings by Frequency of the Smallest Character

Compare Strings by Frequency of the Smallest Character requires counting minimal character frequencies in words and quer…

Medium
1177

Can Make Palindrome from Substring

Given a string and queries, determine if a substring can be rearranged and modified to form a palindrome.

Medium
1178

Number of Valid Words for Each Puzzle

Solve the "Number of Valid Words for Each Puzzle" problem with array scanning and hash lookup to efficiently count valid…

Hard
1184

Distance Between Bus Stops

Compute the minimal distance between two bus stops on a circular route using an array-driven solution approach.

Easy
1186

Maximum Subarray Sum with One Deletion

Find the maximum sum of a subarray with at most one deletion in this dynamic programming problem.

Medium
1187

Make Array Strictly Increasing

Determine the minimum operations to transform arr1 into a strictly increasing sequence using values from arr2 efficientl…

Hard
1191

K-Concatenation Maximum Sum

Solve the K-Concatenation Maximum Sum problem using dynamic programming and optimal sub-array sum calculation.

Medium
1200

Minimum Absolute Difference

Find all pairs with the minimum absolute difference between two elements in an array, and return them in ascending order…

Easy
1202

Smallest String With Swaps

Find the lexicographically smallest string by swapping characters in given pairs of indices.

Medium
1207

Unique Number of Occurrences

Determine if each integer in an array occurs a unique number of times using efficient hash-based counting and verificati…

Easy
1210

Minimum Moves to Reach Target with Rotations

Find the minimum moves for a 2-cell snake to reach the bottom-right corner using rotations and BFS traversal in a grid.

Hard
1217

Minimum Cost to Move Chips to The Same Position

Compute the minimum cost to move all chips to one position using parity-based greedy moves efficiently.

Easy
1218

Longest Arithmetic Subsequence of Given Difference

Find the longest arithmetic subsequence with a given difference using dynamic programming and hash tables.

Medium
1219

Path with Maximum Gold

Find the path with the maximum gold in a grid with backtracking and pruning techniques to maximize the gold collected.

Medium
1222

Queens That Can Attack the King

Identify all black queens on an 8x8 chessboard that can attack the white king using array and matrix simulation techniqu…

Medium
1223

Dice Roll Simulation

Calculate all valid sequences of n dice rolls with consecutive roll constraints using state transition dynamic programmi…

Hard
1224

Maximum Equal Frequency

Find the longest prefix of an array where removing one element makes all numbers appear equally, using efficient hash tr…

Hard
1232

Check If It Is a Straight Line

Determine if a series of coordinates form a straight line on a 2D plane using geometry and mathematical principles.

Easy
1233

Remove Sub-Folders from the Filesystem

Remove sub-folders in a filesystem by filtering out folders nested inside other folders.

Medium
1235

Maximum Profit in Job Scheduling

Compute the maximum profit from non-overlapping jobs using state transition dynamic programming with sorted arrays and b…

Hard
1239

Maximum Length of a Concatenated String with Unique Characters

Find the maximum length of a concatenated string from an array with all unique characters using backtracking search with…

Medium
1248

Count Number of Nice Subarrays

The problem requires counting subarrays with exactly k odd numbers using an efficient array scanning approach.

Medium
1250

Check If It Is a Good Array

Determine if a given array of positive integers can generate 1 using integer multiples of any subset, leveraging number …

Hard
1252

Cells with Odd Values in a Matrix

This problem involves updating a matrix based on given indices and counting cells with odd values afterward.

Easy
1253

Reconstruct a 2-Row Binary Matrix

Reconstruct a 2-row binary matrix by distributing column sums while respecting upper and lower row limits using greedy p…

Medium
1254

Number of Closed Islands

Count the number of closed islands in a 2D grid using array traversal and depth-first search efficiently.

Medium
1255

Maximum Score Words Formed by Letters

Calculate the highest total score by selecting words from a list using available letters, respecting individual letter s…

Hard
1260

Shift 2D Grid

Shift 2D Grid requires shifting elements of a matrix by a given number of times, simulating step-by-step movement.

Easy
1262

Greatest Sum Divisible by Three

Find the maximum sum divisible by three from a given array using dynamic programming and state transition.

Medium
1263

Minimum Moves to Move a Box to Their Target Location

Solve the minimum moves to push a box to its target using BFS and priority handling in a grid-based warehouse layout eff…

Hard
1266

Minimum Time Visiting All Points

Calculate the minimum seconds required to visit all given 2D points in order using optimal diagonal or straight moves.

Easy
1267

Count Servers that Communicate

Count Servers that Communicate involves identifying servers in a grid that can communicate based on row or column connec…

Medium
1268

Search Suggestions System

Design a search suggestion system that provides the top three lexicographically smallest products matching a search word…

Medium
1275

Find Winner on a Tic Tac Toe Game

Determine the winner of a Tic Tac Toe game by scanning moves and using hash lookups for rows, columns, and diagonals eff…

Easy
1277

Count Square Submatrices with All Ones

Count the number of square submatrices with all ones in a given binary matrix using dynamic programming.

Medium
1282

Group the People Given the Group Size They Belong To

Organize people into groups based on their specified group sizes using array scanning and hash table bucketing efficient…

Medium
1283

Find the Smallest Divisor Given a Threshold

Find the smallest divisor such that the sum of all divided array elements is less than or equal to the threshold.

Medium
1284

Minimum Number of Flips to Convert Binary Matrix to Zero Matrix

Compute the minimum flips to convert a binary matrix to zero by toggling cells and neighbors using array scanning plus h…

Hard
1287

Element Appearing More Than 25% In Sorted Array

Identify the integer occurring more than 25% in a sorted array using a precise array-driven search strategy for efficien…

Easy
1288

Remove Covered Intervals

Remove all intervals fully covered by another using sorting and linear traversal, counting only distinct remaining inter…

Medium
1289

Minimum Falling Path Sum II

Find the minimum sum of a falling path in a square matrix using dynamic programming while avoiding same-column selection…

Hard
1292

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

This problem challenges you to find the largest square in a matrix with a sum below a given threshold using binary searc…

Medium
1293

Shortest Path in a Grid with Obstacles Elimination

Find the shortest path in a grid with obstacles, allowing the elimination of up to k obstacles using BFS.

Hard
1295

Find Numbers with Even Number of Digits

Count the integers in an array that have an even number of digits using a direct array traversal with digit math.

Easy
1296

Divide Array in Sets of K Consecutive Numbers

Determine if an integer array can be partitioned into sets of k consecutive numbers using array scanning and hash mappin…

Medium
1298

Maximum Candies You Can Get from Boxes

Collect maximum candies from boxes by exploring initially available boxes and using keys to unlock additional ones effic…

Hard
1299

Replace Elements with Greatest Element on Right Side

Replace every element in an array with the greatest element on its right side, and replace the last element with -1.

Easy
1300

Sum of Mutated Array Closest to Target

Find the integer that mutates all larger elements in an array to minimize the sum difference to a target efficiently.

Medium
1301

Number of Paths with Max Score

Calculate the maximum score path and count all valid routes in a square board with obstacles using dynamic programming.

Hard
1304

Find N Unique Integers Sum up to Zero

Generate an array of n unique integers that sum to zero using a symmetric pairing strategy to ensure balance.

Easy
1306

Jump Game III

Jump Game III challenges you to determine if you can reach any zero in an array using jumps defined by array values, tes…

Medium
1307

Verbal Arithmetic Puzzle

Check if a verbal arithmetic equation can be solved using a valid digit-letter mapping.

Hard
1310

XOR Queries of a Subarray

Compute XOR results for multiple subarray queries using efficient prefix XOR to reduce repeated computation overhead in …

Medium
1311

Get Watched Videos by Your Friends

Find videos watched by friends up to a given level and return them sorted by frequency and alphabetically.

Medium
1313

Decompress Run-Length Encoded List

Decompress a run-length encoded list by expanding each pair into repeated values based on frequency.

Easy
1314

Matrix Block Sum

Compute a matrix where each cell contains the sum of all elements within k-distance blocks using prefix sums efficiently…

Medium
1324

Print Words Vertically

Transform a string into vertical columns by arranging each word character in array positions while trimming trailing spa…

Medium
1326

Minimum Number of Taps to Open to Water a Garden

Determine the minimum number of taps to water an entire garden using state transition dynamic programming and interval c…

Hard
1329

Sort the Matrix Diagonally

Sort each diagonal of a matrix in ascending order, applying sorting and matrix traversal techniques.

Medium
1330

Reverse Subarray To Maximize Array Value

Maximize the value of an array by reversing a subarray, focusing on greedy choices and invariant validation.

Hard
1331

Rank Transform of an Array

Transform the elements of an array into their ranks, where the rank represents the size order of the elements.

Easy
1333

Filter Restaurants by Vegan-Friendly, Price and Distance

Filter restaurants by vegan-friendly status, price, and distance, and sort them by rating and ID.

Medium
1335

Minimum Difficulty of a Job Schedule

Schedule jobs into multiple days to minimize the difficulty of the schedule using dynamic programming and state transiti…

Hard
1337

The K Weakest Rows in a Matrix

Find the k weakest rows in a binary matrix where rows contain soldiers and civilians, using sorting and binary search te…

Easy
1338

Reduce Array Size to The Half

This problem asks to minimize the set of integers removed to reduce an array's size to at least half by removing occurre…

Medium
1340

Jump Game V

Jump Game V is a hard dynamic programming problem that focuses on maximizing jumps between indices in an array.

Hard
1343

Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold

Given an array, find the number of sub-arrays of size k with an average greater than or equal to a given threshold.

Medium
1345

Jump Game IV

Jump Game IV requires minimizing steps to reach the last index using jumps across equal values and neighbors efficiently…

Hard
1346

Check If N and Its Double Exist

Solve Check If N and Its Double Exist by scanning once and checking doubles or halves in a hash set.

Easy
1349

Maximum Students Taking Exam

Calculate the maximum number of students who can take an exam without cheating using state transition dynamic programmin…

Hard
1351

Count Negative Numbers in a Sorted Matrix

Count Negative Numbers in a Sorted Matrix requires counting negative numbers in a matrix sorted in non-increasing order …

Easy
1352

Product of the Last K Numbers

Design a data structure to efficiently return the product of the last k numbers in a dynamic integer stream using prefix…

Medium
1353

Maximum Number of Events That Can Be Attended

Maximize the number of events you can attend given their start and end days using a greedy strategy.

Medium
1354

Construct Target Array With Multiple Sums

This problem requires constructing a target array from an array of ones, using multiple sum operations and a priority qu…

Hard
1356

Sort Integers by The Number of 1 Bits

Sort an array of integers by the number of 1's in their binary representation and then by their value in case of ties.

Easy
1357

Apply Discount Every n Orders

Compute customer bills with periodic discounts efficiently using array scanning and hash mapping for fast product price …

Medium
1363

Largest Multiple of Three

Find the largest number divisible by three by selecting and ordering digits optimally using state transition dynamic pro…

Hard
1365

How Many Numbers Are Smaller Than the Current Number

In this problem, you need to determine how many numbers are smaller than each element in an array, focusing on array sca…

Easy
1366

Rank Teams by Votes

Rank Teams by Votes requires counting position-based votes and resolving ties with array scanning and hash lookup techni…

Medium
1368

Minimum Cost to Make at Least One Valid Path in a Grid

Determine the minimum cost to create at least one valid path from the top-left to bottom-right in a directional grid.

Hard
1375

Number of Times Binary String Is Prefix-Aligned

Count how many times a 1-indexed binary string becomes prefix-aligned as bits are flipped sequentially using an array-dr…

Medium
1380

Lucky Numbers in a Matrix

The Lucky Numbers in a Matrix problem involves finding elements that are the minimum in their row and maximum in their c…

Easy
1381

Design a Stack With Increment Operation

Implement a stack that supports push, pop, and targeted increment operations efficiently using array-based state managem…

Medium
1383

Maximum Performance of a Team

Maximize the performance of a team by selecting up to k engineers with the highest performance based on speed and effici…

Hard
1385

Find the Distance Value Between Two Arrays

Calculate the distance value between two integer arrays by determining how many elements in arr1 don't have a close coun…

Easy
1386

Cinema Seat Allocation

Determine the maximum number of four-person groups that can be seated in a cinema using array scanning and hash lookup e…

Medium
1388

Pizza With 3n Slices

Maximize your pizza slice sum from a 3n-sized circular array using state transition dynamic programming efficiently.

Hard
1389

Create Target Array in the Given Order

Learn how to efficiently create a target array by inserting elements at specified indices using array simulation techniq…

Easy
1390

Four Divisors

Compute the sum of all divisors for numbers in an array that have exactly four divisors using array and math techniques.

Medium
1391

Check if There is a Valid Path in a Grid

Check if there is a valid path from the upper-left to the bottom-right corner of a grid using depth-first search.

Medium
1394

Find Lucky Integer in an Array

Identify the largest lucky integer in an array by counting frequencies and comparing values with their occurrences effic…

Easy
1395

Count Number of Teams

Count the number of valid three-soldier teams using ratings with a state transition dynamic programming approach efficie…

Medium
1402

Reducing Dishes

Maximize the sum of like-time coefficients by optimally choosing dishes to prepare in this dynamic programming problem.

Hard
1403

Minimum Subsequence in Non-Increasing Order

Find the minimum subsequence in non-increasing order such that its sum exceeds the sum of non-included elements.

Easy
1406

Stone Game III

Stone Game III is a challenging dynamic programming problem based on game theory and state transition logic.

Hard
1408

String Matching in an Array

Identify all strings in an array that appear as substrings of other strings, focusing on array and string matching patte…

Easy
1409

Queries on a Permutation With Key

This problem involves processing queries on a permutation using an array and binary indexed tree for efficient results.

Medium
1413

Minimum Value to Get Positive Step by Step Sum

Find the minimum starting value to ensure the step-by-step sum of an array is always at least 1.

Easy
1418

Display Table of Food Orders in a Restaurant

Generate a restaurant display table from orders by counting each food item per table using array scanning and hash looku…

Medium
1423

Maximum Points You Can Obtain from Cards

Maximize your score by selecting k cards from the beginning or end of the array using a sliding window approach.

Medium
1424

Diagonal Traverse II

Traverse a jagged 2D array diagonally by grouping elements with equal row and column sums efficiently using sorting and …

Medium
1425

Constrained Subsequence Sum

Solve the Constrained Subsequence Sum problem using dynamic programming, sliding window, and priority queues to maximize…

Hard
1431

Kids With the Greatest Number of Candies

Determine which kids, after receiving extra candies, will have the greatest number of candies in a group.

Easy
1434

Number of Ways to Wear Different Hats to Each Other

Calculate all unique assignments of hats to people using state transition dynamic programming with bitmasking for collis…

Hard
1436

Destination City

Find the destination city from a list of paths where each path connects two cities. The city with no outgoing path is th…

Easy
1437

Check If All 1's Are at Least Length K Places Away

Check if all 1's in a binary array are at least k places away from each other.

Easy
1438

Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit

Find the longest subarray with elements whose absolute difference is within a specified limit using a sliding window app…

Medium
1439

Find the Kth Smallest Sum of a Matrix With Sorted Rows

Find the kth smallest sum in a matrix with sorted rows using binary search and a heap-based approach.

Hard
1441

Build an Array With Stack Operations

Simulate stack operations to match a target array while processing numbers from 1 to n.

Medium
1442

Count Triplets That Can Form Two Arrays of Equal XOR

Efficiently count all triplets in an array where two subarrays formed by splitting have equal XOR using array scanning a…

Medium
1444

Number of Ways of Cutting a Pizza

This problem challenges you to determine the number of valid ways to cut a pizza into pieces with apples using dynamic p…

Hard
1449

Form Largest Integer With Digits That Add up to Target

Maximize the integer you can paint with given digit costs under a target sum, using dynamic programming to optimize the …

Hard
1450

Number of Students Doing Homework at a Given Time

Count the number of students doing homework at a given time using an array-driven solution approach.

Easy
1452

People Whose List of Favorite Companies Is Not a Subset of Another List

Identify people whose favorite companies lists are unique and not subsets of any other person's list using efficient arr…

Medium
1453

Maximum Number of Darts Inside of a Circular Dartboard

Maximize the number of darts on a circular dartboard given dart positions and radius.

Hard
1458

Max Dot Product of Two Subsequences

Solve Max Dot Product of Two Subsequences with state transition dynamic programming that enforces a non-empty pairing de…

Hard
1460

Make Two Arrays Equal by Reversing Subarrays

Solve Make Two Arrays Equal by Reversing Subarrays by checking whether target and arr contain the same values with match…

Easy
1463

Cherry Pickup II

Maximize cherry collection in a grid using two robots with careful state transition dynamic programming to optimize path…

Hard
1464

Maximum Product of Two Elements in an Array

Find the maximum product of two elements in an array by carefully selecting indices and leveraging sorting for efficienc…

Easy
1465

Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts

Maximize the area of a piece of cake after specified horizontal and vertical cuts using greedy algorithms and sorting.

Medium
1467

Probability of a Two Boxes Having The Same Number of Distinct Balls

Compute the probability that two boxes contain the same number of distinct balls using careful combinatorial and DP meth…

Hard
1470

Shuffle the Array

Shuffle the Array requires an efficient approach to rearrange elements using an array-driven solution strategy with two …

Easy
1471

The k Strongest Values in an Array

Identify the k strongest values in an array using two-pointer scanning and careful tracking of the array's centre value.

Medium
1472

Design Browser History

Implement a browser history tracker with back, forward, and visit operations using linked-list pointer manipulation effi…

Medium
1473

Paint House III

Solve Paint House III using state transition dynamic programming to minimize painting costs while forming exact neighbor…

Hard
1475

Final Prices With a Special Discount in a Shop

Calculate final prices with discounts applied in a shop using a stack-based state management approach to find the correc…

Easy
1476

Subrectangle Queries

Implement the SubrectangleQueries class to handle dynamic updates and value queries on a 2D rectangle.

Medium
1477

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

Find two non-overlapping sub-arrays with a given target sum and return the minimal total length efficiently using array …

Medium
1478

Allocate Mailboxes

Allocate k mailboxes to houses along a street minimizing total distance using dynamic programming with state transitions…

Hard
1480

Running Sum of 1d Array

Calculate the running sum of a given 1D array by updating each element to the sum of itself and all previous elements.

Easy
1481

Least Number of Unique Integers after K Removals

Find the least number of unique integers after removing exactly k elements from an array using efficient frequency count…

Medium
1482

Minimum Number of Days to Make m Bouquets

Determine the minimum number of days required to make m bouquets using k adjacent flowers efficiently with binary search…

Medium
1487

Making File Names Unique

This problem requires creating unique folder names by appending suffixes to duplicate names using an array scanning and …

Medium
1488

Avoid Flood in The City

This problem asks you to avoid flooding by deciding when to dry lakes between rain events.

Medium
1491

Average Salary Excluding the Minimum and Maximum Salary

Calculate the average salary of employees, excluding the highest and lowest salaries, from an array of unique salaries.

Easy
1493

Longest Subarray of 1's After Deleting One Element

Solve LeetCode 1493 by tracking runs of 1s around one deletion using a tight sliding window or state transition DP.

Medium
1497

Check If Array Pairs Are Divisible by k

Check if array pairs are divisible by k by pairing elements whose sums are divisible by k using array scanning and hash …

Medium
1498

Number of Subsequences That Satisfy the Given Sum Condition

Count all non-empty subsequences in an integer array where the sum of the minimum and maximum elements is at most a targ…

Medium
1499

Max Value of Equation

Max Value of Equation asks to find the maximum value of a specific equation on a set of 2D points using sliding window t…

Hard
1502

Can Make Arithmetic Progression From Sequence

Determine if a given array can be rearranged into a valid arithmetic progression using sorting and consecutive differenc…

Easy
1503

Last Moment Before All Ants Fall Out of a Plank

This problem involves simulating ant movement on a plank to determine the last moment before all ants fall off.

Medium
1504

Count Submatrices With All Ones

Count Submatrices With All Ones is a dynamic programming problem focusing on submatrix counting using an efficient row-b…

Medium
1508

Range Sum of Sorted Subarray Sums

Compute the sum of sorted subarray sums efficiently using binary search over valid sum ranges and prefix sum accumulatio…

Medium
1509

Minimum Difference Between Largest and Smallest Value in Three Moves

Find the minimum difference between the largest and smallest values in an array after performing at most three moves.

Medium
1512

Number of Good Pairs

Count all index pairs in an array where elements match and the first index is smaller, using hash-based scanning efficie…

Easy
1514

Path with Maximum Probability

Find the path with the highest success probability in a graph from a start node to an end node, using edge probabilities…

Medium
1515

Best Position for a Service Centre

Find the optimal service center position in a city by minimizing the sum of Euclidean distances to all customers.

Hard
1521

Find a Value of a Mysterious Function Closest to Target

In this problem, you'll use binary search to find the closest value of a mysterious function to a given target.

Hard
1524

Number of Sub-arrays With Odd Sum

Count the number of subarrays with an odd sum using dynamic programming and prefix sum techniques.

Medium
1526

Minimum Number of Increments on Subarrays to Form a Target Array

The problem asks for the minimum number of operations to transform an initial array of zeros into a target array using s…

Hard
1528

Shuffle String

Reorder characters in a string using a given indices array to reconstruct the intended output efficiently and correctly.

Easy
1534

Count Good Triplets

Count Good Triplets requires identifying all triplets in an array that satisfy multiple absolute difference constraints …

Easy
1535

Find the Winner of an Array Game

Determine the integer that wins an array game by achieving k consecutive victories through simulated pairwise comparison…

Medium
1536

Minimum Swaps to Arrange a Binary Grid

Compute the minimum number of adjacent row swaps to transform a binary grid so all upper-triangle cells are zero using a…

Medium
1537

Get the Maximum Score

Find the maximum possible score from two sorted arrays with a dynamic programming approach, leveraging partitioning and …

Hard
1539

Kth Missing Positive Number

Find the kth missing positive integer in a strictly increasing array using binary search over the answer space efficient…

Easy
1546

Maximum Number of Non-Overlapping Subarrays With Sum Equals Target

Find the maximum number of non-overlapping subarrays that sum to a given target using efficient scanning and hash lookup…

Medium
1547

Minimum Cost to Cut a Stick

Find the minimum cost to cut a stick into segments at specified positions using dynamic programming and sorting.

Hard
1550

Three Consecutive Odds

Determine if an integer array contains three consecutive odd numbers using a direct array-driven solution strategy for f…

Easy
1552

Magnetic Force Between Two Balls

Maximize the minimum magnetic force between balls by strategically placing them in baskets using binary search on positi…

Medium
1558

Minimum Numbers of Function Calls to Make Target Array

Calculate the minimum number of modify calls needed to convert an all-zero array into a given target array using greedy …

Medium
1559

Detect Cycles in 2D Grid

Detect cycles in a 2D character grid using DFS while carefully tracking parent cells to avoid invalid revisits.

Medium
1560

Most Visited Sector in a Circular Track

Determine which sectors on a circular track are visited most frequently using array and simulation techniques efficientl…

Easy
1561

Maximum Number of Coins You Can Get

Solve the Maximum Number of Coins You Can Get using greedy pile selection and invariant validation to maximize your coin…

Medium
1562

Find Latest Group of Size M

Determine the latest step where a contiguous group of ones of exact length m exists using array scanning and hash tracki…

Medium
1563

Stone Game V

In Stone Game V, Alice divides stones into rows to maximize her score, using a dynamic programming approach to try all d…

Hard
1566

Detect Pattern of Length M Repeated K or More Times

Determine if a subarray of length m repeats k or more consecutive times in a given integer array efficiently.

Easy
1567

Maximum Length of Subarray With Positive Product

Given an array, find the maximum length of a subarray with a positive product using dynamic programming.

Medium
1568

Minimum Number of Days to Disconnect Island

Find the minimum number of days to disconnect an island in a grid using depth-first search.

Hard
1569

Number of Ways to Reorder Array to Get Same BST

Determine the number of ways to reorder an array to get the same binary search tree (BST) from its insertion order.

Hard
1572

Matrix Diagonal Sum

Calculate the sum of both primary and secondary diagonals in a square matrix while avoiding double-counting overlaps.

Easy
1574

Shortest Subarray to be Removed to Make Array Sorted

Find the shortest subarray to remove in order to make an array non-decreasing using binary search and two-pointer techni…

Medium
1575

Count All Possible Routes

This problem requires counting all possible routes between cities using fuel efficiently with state transition dynamic p…

Hard
1577

Number of Ways Where Square of Number Is Equal to Product of Two Numbers

Find the number of triplets where the square of a number equals the product of two others, utilizing array scanning and …

Medium
1578

Minimum Time to Make Rope Colorful

Minimize the time Bob needs to remove balloons to make a rope colorful using dynamic programming with state transitions.

Medium
1582

Special Positions in a Binary Matrix

Identify all special positions in a binary matrix where a 1 has no other 1s in its row or column, ensuring optimal array…

Easy
1583

Count Unhappy Friends

Determine the number of unhappy friends in paired arrangements using array-based simulation for preference violations.

Medium
1584

Min Cost to Connect All Points

Min Cost to Connect All Points asks for the minimum cost to connect all points on a 2D plane, using manhattan distances …

Medium
1588

Sum of All Odd Length Subarrays

Calculate the sum of all odd-length subarrays in a given integer array using efficient array and math strategies.

Easy
1589

Maximum Sum Obtained of Any Permutation

Maximize the total sum of requests on nums by greedily assigning larger numbers to most frequently requested indices.

Medium
1590

Make Sum Divisible by P

Determine the minimum-length subarray to remove so the remaining array sum is divisible by a given integer p efficiently…

Medium
1591

Strange Printer II

Solve Strange Printer II by building color dependencies from bounding rectangles and checking whether a topological orde…

Hard
1594

Maximum Non Negative Product in a Matrix

Find the maximum non-negative product path in a matrix using dynamic programming and state transition.

Medium
1595

Minimum Cost to Connect Two Groups of Points

Compute the minimum cost to fully connect two groups of points using dynamic programming and bitmasking efficiently.

Hard
1598

Crawler Log Folder

Simulate folder navigation based on a list of operations to determine the current folder depth.

Easy
1599

Maximum Profit of Operating a Centennial Wheel

Maximize the profit from operating a Centennial Wheel by determining the optimal number of rotations based on customer a…

Medium
1601

Maximum Number of Achievable Transfer Requests

Find the maximum number of achievable transfer requests between buildings with constraints on net employee transfers.

Hard
1604

Alert Using Same Key-Card Three or More Times in a One Hour Period

Solve LeetCode 1604 by grouping swipe times per employee, sorting each list, and scanning for any three within 60 minute…

Medium
1605

Find Valid Matrix Given Row and Column Sums

Given row and column sums, find any valid matrix of non-negative integers that satisfies them.

Medium
1606

Find Servers That Handled Most Number of Requests

Given k servers and a series of requests, find the busiest server(s) using greedy strategies and efficient server tracki…

Hard
1608

Special Array With X Elements Greater Than or Equal X

Determine if an array has exactly x elements greater than or equal to x using binary search over the answer space.

Easy
1610

Maximum Number of Visible Points

Determine the maximum number of points visible from a fixed location within a given angle using a sliding window approac…

Hard
1619

Mean of Array After Removing Some Elements

Calculate the trimmed mean by removing the lowest and highest 5% of elements in an array using sorting for accuracy and …

Easy
1620

Coordinate With Maximum Network Quality

Determine the coordinate with the maximum network quality by summing signal strengths from all reachable towers efficien…

Medium
1626

Best Team With No Conflicts

Find the highest score basketball team by choosing players without conflicts in age and score using dynamic programming.

Medium
1627

Graph Connectivity With Threshold

In 'Graph Connectivity With Threshold,' determine if cities are connected based on common divisors exceeding a threshold…

Hard
1629

Slowest Key

Determine which key had the longest press duration in a sequence using array indices and string mapping, resolving ties …

Easy
1630

Arithmetic Subarrays

Determine whether subarrays of a given array can be rearranged to form arithmetic sequences using array scanning and has…

Medium
1631

Path With Minimum Effort

Find the minimum effort required to travel from the top-left to the bottom-right of a grid, considering height differenc…

Medium
1632

Rank Transform of a Matrix

Compute a unique rank matrix using graph indegree with topological ordering, ensuring each element reflects its relative…

Hard
1636

Sort Array by Increasing Frequency

Sort Array by Increasing Frequency requires counting each element and ordering them by frequency, breaking ties with des…

Easy
1637

Widest Vertical Area Between Two Points Containing No Points

Find the maximum width of a vertical area between points with no points inside using array sorting efficiently.

Easy
1639

Number of Ways to Form a Target String Given a Dictionary

Calculate the number of ways to form a target string using words of equal length via state transition dynamic programmin…

Hard
1640

Check Array Formation Through Concatenation

Determine if an array can be formed by concatenating subarrays without reordering individual elements, using hash lookup…

Easy
1642

Furthest Building You Can Reach

Furthest Building You Can Reach explores a greedy approach with heap-based optimization to find the maximum reachable bu…

Medium
1643

Kth Smallest Instructions

Find the kth smallest lexicographic instruction sequence for reaching a destination in a grid using state transition dyn…

Hard
1646

Get Maximum in Generated Array

Compute the maximum value in a generated array using defined recurrence rules, leveraging array simulation techniques ef…

Easy
1648

Sell Diminishing-Valued Colored Balls

Maximize total value by greedily selling diminishing-valued colored balls based on inventory and customer orders.

Medium
1649

Create Sorted Array through Instructions

The problem asks to compute the cost of inserting elements into a sorted array using a series of instructions.

Hard
1652

Defuse the Bomb

Defuse the Bomb uses a sliding window to update a circular array based on a key, with efficient state updates.

Easy
1654

Minimum Jumps to Reach Home

Find the minimum number of jumps needed to reach a target position while avoiding forbidden positions.

Medium
1655

Distribute Repeating Integers

Determine if you can allocate integers to satisfy customer quantities using state transition dynamic programming techniq…

Hard
1656

Design an Ordered Stream

Design an Ordered Stream that returns values in increasing order based on unique integer IDs with efficient insertion an…

Easy
1658

Minimum Operations to Reduce X to Zero

Find the minimum number of operations to reduce a value x to zero by removing elements from an array.

Medium
1662

Check If Two String Arrays are Equivalent

Determine if two string arrays form identical strings by concatenating elements in order, handling subtle array-length m…

Easy
1664

Ways to Make a Fair Array

Solve Ways to Make a Fair Array by tracking parity sums before and after each removal with prefix-sum style accounting.

Medium
1665

Minimum Initial Energy to Finish Tasks

Determine the minimum initial energy needed to finish all tasks using a greedy ordering based on required versus actual …

Hard
1670

Design Front Middle Back Queue

Implement a queue that efficiently handles push and pop operations at the front, middle, and back using pointer manipula…

Medium
1671

Minimum Number of Removals to Make Mountain Array

Solve the problem of finding the minimum number of removals to make a given array a mountain array using dynamic program…

Hard
1672

Richest Customer Wealth

Calculate the richest customer's wealth by summing the amounts in each customer's bank accounts in a matrix.

Easy
1673

Find the Most Competitive Subsequence

Identify the lexicographically smallest subsequence of size k using stack-based greedy selection in array traversal.

Medium
1674

Minimum Moves to Make Array Complementary

Find the minimum moves to make an array complementary by analyzing paired sums and using hash lookups for efficiency.

Medium
1675

Minimize Deviation in Array

Given a positive integer array, repeatedly double or halve elements to minimize the difference between its largest and s…

Hard
1679

Max Number of K-Sum Pairs

Max Number of K-Sum Pairs is a problem involving counting disjoint pairs with a given sum k in an array.

Medium
1681

Minimum Incompatibility

Optimize the sum of incompatibilities when distributing an array into subsets with unique elements.

Hard
1684

Count the Number of Consistent Strings

Count the number of strings fully composed of allowed characters using array scanning and hash lookup for efficiency.

Easy
1685

Sum of Absolute Differences in a Sorted Array

Calculate the sum of absolute differences between each element and others in a sorted array efficiently.

Medium
1686

Stone Game VI

Determine the winner in Stone Game VI using a greedy strategy that accounts for each stone's dual value impact on Alice …

Medium
1687

Delivering Boxes from Storage to Ports

Optimize the minimum number of trips to deliver boxes to ports under strict ship constraints using dynamic programming t…

Hard
1690

Stone Game VII

Maximize score difference in a two-player turn-based stone removal game using state transition dynamic programming.

Medium
1691

Maximum Height by Stacking Cuboids

Maximize the height of stacked cuboids by strategically rotating and stacking them using dynamic programming.

Hard
1695

Maximum Erasure Value

Maximize the score by erasing a subarray with unique elements in an array of integers.

Medium
1696

Jump Game VI

Jump Game VI challenges you to maximize your score while jumping through an array using state transition dynamic program…

Medium
1697

Checking Existence of Edge Length Limited Paths

Solve the problem of checking if there exists a path between two nodes under edge length constraints using efficient tec…

Hard
1700

Number of Students Unable to Eat Lunch

Simulate a queue of students with sandwich preferences and determine how many can't eat based on available sandwiches.

Easy
1701

Average Waiting Time

Compute the average waiting time for customers using array traversal and simulation of a single chef processing orders s…

Medium
1703

Minimum Adjacent Swaps for K Consecutive Ones

Find the minimum number of adjacent swaps to gather k consecutive ones in a binary array using sliding window logic.

Hard
1705

Maximum Number of Eaten Apples

Maximize apples eaten by choosing the best apples first, considering their rot days and available days to eat them.

Medium
1706

Where Will the Ball Fall

Determine where each ball exits a diagonal board grid or if it gets stuck, using matrix simulation with careful traversa…

Medium
1707

Maximum XOR With an Element From Array

Solve the Maximum XOR With an Element From Array problem by efficiently finding the maximum XOR for each query using bit…

Hard
1710

Maximum Units on a Truck

Maximize total units loaded on a truck by choosing boxes greedily based on highest units per box within truck capacity l…

Easy
1711

Count Good Meals

Count Good Meals asks you to find pairs of food items with a sum of deliciousness equal to a power of two.

Medium
1712

Ways to Split Array Into Three Subarrays

The problem requires finding the number of ways to split an array into three subarrays where each split meets a certain …

Medium
1713

Minimum Operations to Make a Subsequence

Compute the minimum insertions required to transform arr so that target becomes its subsequence using array scanning and…

Hard
1718

Construct the Lexicographically Largest Valid Sequence

Construct the Lexicographically Largest Valid Sequence problem involves finding the largest sequence with backtracking a…

Medium
1720

Decode XORed Array

Recover the original integer array from its XOR-encoded version using direct bitwise manipulation and sequential reconst…

Easy
1722

Minimize Hamming Distance After Swap Operations

Solve Minimize Hamming Distance After Swap Operations by grouping swappable indices and matching value counts inside eac…

Medium
1723

Find Minimum Time to Finish All Jobs

Minimize the maximum working time of k workers by optimally assigning jobs, leveraging dynamic programming and bit manip…

Hard
1725

Number Of Rectangles That Can Form The Largest Square

Determine how many rectangles can be trimmed to form the largest possible square using an array-driven solution strategy…

Easy
1726

Tuple with Same Product

Given an array of distinct integers, return the number of tuples where the product of two pairs is the same.

Medium
1727

Largest Submatrix With Rearrangements

Rearrange columns of a binary matrix to find the largest submatrix of 1s.

Medium
1728

Cat and Mouse II

Cat and Mouse II requires determining if the mouse can reach food before being caught using graph and topological orderi…

Hard
1732

Find the Highest Altitude

Find the highest altitude after a series of altitude changes during a road trip using prefix sum technique.

Easy
1733

Minimum Number of People to Teach

Minimize the number of users to teach a language that ensures all friends can communicate in a social network.

Medium
1734

Decode XORed Permutation

Decode XORed Permutation uses prefix reconstruction with global XOR to recover the hidden odd-length permutation in line…

Medium
1735

Count Ways to Make Array With Product

Determine the number of arrays of size n where the product equals k using prime factorization and combinatorial DP techn…

Hard
1738

Find Kth Largest XOR Coordinate Value

Compute the kth largest XOR coordinate in a 2D matrix using prefix sums, bit manipulation, and optimized selection techn…

Medium
1743

Restore the Array From Adjacent Pairs

Restore the Array From Adjacent Pairs reconstructs a sequence using adjacent element pairs. Efficient hash lookups and a…

Medium
1744

Can You Eat Your Favorite Candy on Your Favorite Day?

Determine if you can eat a candy of your favorite type on a specific day, given daily limits and candy availability.

Medium
1748

Sum of Unique Elements

Given an array, find the sum of all its unique elements by identifying those that appear only once.

Easy
1749

Maximum Absolute Sum of Any Subarray

Solve for the maximum absolute sum of any subarray using dynamic programming and understanding state transitions.

Medium
1751

Maximum Number of Events That Can Be Attended II

Determine the maximum sum of event values you can collect by attending at most k non-overlapping events using DP.

Hard
1752

Check if Array Is Sorted and Rotated

Determine if a given integer array is sorted in non-decreasing order and then rotated, handling duplicates correctly.

Easy
1755

Closest Subsequence Sum

Find the minimum absolute difference between a target goal and any subsequence sum using optimized dynamic programming a…

Hard
1760

Minimum Limit of Balls in a Bag

Find the minimum penalty (maximum balls in a bag) after performing up to maxOperations to split bags of balls.

Medium
1764

Form Array by Concatenating Subarrays of Another Array

Determine if you can sequentially select disjoint subarrays from nums matching each group in order using two-pointer sca…

Medium
1765

Map of Highest Peak

Solve the Map of Highest Peak problem using breadth-first search to assign heights based on proximity to water cells.

Medium
1766

Tree of Coprimes

Determine the closest coprime ancestor for each node in a tree using efficient traversal and state tracking of node valu…

Hard
1769

Minimum Number of Operations to Move All Balls to Each Box

Solve the problem of finding the minimum operations to move balls to each box using an efficient approach with arrays an…

Medium
1770

Maximum Score from Performing Multiplication Operations

Solve the Maximum Score from Performing Multiplication Operations problem using dynamic programming and state transition…

Hard
1773

Count Items Matching a Rule

Count Items Matching a Rule is an easy problem that tests array and string manipulation with conditions based on specifi…

Easy
1774

Closest Dessert Cost

Find the closest dessert cost to a target by selecting from a list of base flavors and topping combinations using dynami…

Medium
1775

Equal Sum Arrays With Minimum Number of Operations

Solve the problem of balancing the sums of two integer arrays with minimal operations, using array scanning and hash loo…

Medium
1776

Car Fleet II

Car Fleet II involves calculating collision times between cars traveling at different speeds along a one-lane road using…

Hard
1779

Find Nearest Point That Has the Same X or Y Coordinate

Find the nearest point with the same x or y coordinate using Manhattan distance. Return its index or -1 if none exists.

Easy
1782

Count Pairs Of Nodes

Given a graph with nodes and edges, count pairs of nodes where the degree sum exceeds a given threshold for each query.

Hard
1785

Minimum Elements to Add to Form a Given Sum

Compute the gap between current sum and goal, then greedily cover it with limit-sized additions to get the minimum count…

Medium
1787

Make the XOR of All Segments Equal to Zero

Determine the minimum changes needed in an array so all size-k segments XOR to zero using DP and bit manipulation.

Hard
1792

Maximum Average Pass Ratio

Maximize the average pass ratio by assigning extra guaranteed-passing students using a greedy heap strategy for optimal …

Medium
1793

Maximum Score of a Good Subarray

Maximize the score of a good subarray using binary search to explore the valid answer space with a focus on two-pointer …

Hard
1798

Maximum Number of Consecutive Values You Can Make

Find the maximum number of consecutive integer values starting from zero that can be formed using your coins array.

Medium
1799

Maximize Score After N Operations

Maximize the score after n operations by selecting pairs from the array and using their GCD with dynamic programming or …

Hard
1800

Maximum Ascending Subarray Sum

Solve Maximum Ascending Subarray Sum by scanning once, extending rising runs, and resetting the running sum at each drop…

Easy
1801

Number of Orders in the Backlog

Determine the total number of unfulfilled buy and sell orders using heaps to simulate backlog processing efficiently in …

Medium
1803

Count Pairs With XOR in a Range

Count all pairs in an array whose XOR falls within a given range using efficient bit manipulation techniques and a trie …

Hard
1806

Minimum Number of Operations to Reinitialize a Permutation

Find the minimum number of operations to reinitialize a permutation of size n using specific operations.

Medium
1807

Evaluate the Bracket Pairs of a String

Quickly evaluate a string with bracketed keys using array scanning and hash table lookups for efficient replacements.

Medium
1813

Sentence Similarity III

Sentence Similarity III asks if one sentence can be transformed into another by inserting a sentence inside it.

Medium
1814

Count Nice Pairs in an Array

Count Nice Pairs in an Array requires efficiently pairing numbers where nums[i] + rev(nums[j]) equals nums[j] + rev(nums…

Medium
1815

Maximum Number of Groups Getting Fresh Donuts

Reorder groups to maximize happy customers by using state transition dynamic programming with bitmasking for optimal bat…

Hard
1816

Truncate Sentence

Truncate a sentence to contain only the first k words by converting it into an array of words.

Easy
1817

Finding the Users Active Minutes

This problem requires counting unique minutes of user activity on LeetCode based on a series of logs and an integer k.

Medium
1818

Minimum Absolute Sum Difference

Minimize the absolute sum difference between two integer arrays by replacing at most one element from the first array.

Medium
1819

Number of Different Subsequences GCDs

Given an array of positive integers, find the number of different subsequences' GCDs.

Hard
1822

Sign of the Product of an Array

Determine the sign of a product from an integer array using a single pass without computing the full product.

Easy
1823

Find the Winner of the Circular Game

Find the winner of a circular game by simulating the elimination process with a queue-driven approach.

Medium
1824

Minimum Sideway Jumps

Solve the Minimum Sideway Jumps problem using state transition dynamic programming to minimize side jumps while navigati…

Medium
1827

Minimum Operations to Make the Array Increasing

Calculate the minimum number of increments required to transform a given integer array into a strictly increasing sequen…

Easy
1828

Queries on Number of Points Inside a Circle

Determine how many 2D points lie within multiple circles using array iteration and Euclidean distance calculations effic…

Medium
1829

Maximum XOR for Each Query

Find the maximum XOR for each query based on a sorted array and bit manipulation.

Medium
1833

Maximum Ice Cream Bars

Maximize the number of ice cream bars a boy can buy by applying a greedy choice strategy based on cost sorting.

Medium
1834

Single-Threaded CPU

Simulate task processing with a single-threaded CPU by sorting and prioritizing tasks based on arrival and processing ti…

Medium
1835

Find XOR Sum of All Pairs Bitwise AND

Compute the XOR sum of all pairwise ANDs between two integer arrays using array and bitwise math techniques efficiently.

Hard
1838

Frequency of the Most Frequent Element

Maximize the frequency of an element in an array by incrementing at most `k` elements. Use binary search and greedy tech…

Medium
1840

Maximum Building Height

Find the maximum building height in a city given height restrictions for specific buildings.

Hard
1846

Maximum Element After Decreasing and Rearranging

Determine the maximum value in an array after decreasing elements and rearranging using a greedy invariant approach.

Medium
1847

Closest Room

Find the closest hotel room meeting minimum size requirements using binary search over the valid answer space efficientl…

Hard
1848

Minimum Distance to the Target Element

Solve Minimum Distance to the Target Element by scanning the array and tracking the smallest distance from start.

Easy
1851

Minimum Interval to Include Each Query

Find the smallest interval containing each query efficiently using binary search.

Hard
1854

Maximum Population Year

Find the earliest year with the highest population using an array plus counting approach.

Easy
1855

Maximum Distance Between a Pair of Values

Find the maximum distance between a pair of values in two non-increasing integer arrays using binary search.

Medium
1856

Maximum Subarray Min-Product

The problem asks to find the maximum min-product of any non-empty subarray of nums.

Medium
1861

Rotating the Box

Rotate a box represented by a character matrix, letting stones fall under gravity using precise two-pointer scanning and…

Medium
1862

Sum of Floored Pairs

The problem asks to calculate the sum of floor divisions for all pairs in a given integer array, using an efficient meth…

Hard
1863

Sum of All Subset XOR Totals

Compute the sum of all subset XOR totals using a backtracking search with pruning for arrays of small size.

Easy
1865

Finding Pairs With a Certain Sum

Efficiently track and count pairs across two arrays using array scanning plus hash lookup to support dynamic updates.

Medium
1870

Minimum Speed to Arrive on Time

This problem asks to find the minimum speed of trains to reach on time using binary search.

Medium
1872

Stone Game VIII

Stone Game VIII requires calculating maximum score difference using state transition dynamic programming on prefix sums …

Hard
1877

Minimize Maximum Pair Sum in Array

Minimize the maximum pair sum in an array by optimally pairing its elements.

Medium
1878

Get Biggest Three Rhombus Sums in a Grid

Find the three largest distinct rhombus sums from a given grid using array and math techniques.

Medium
1879

Minimum XOR Sum of Two Arrays

Minimize the XOR sum of two integer arrays by rearranging elements using dynamic programming and bit manipulation.

Hard
1882

Process Tasks Using Servers

Assign tasks to servers efficiently using arrays and heaps, resolving ties by weight and index while tracking availabili…

Medium
1883

Minimum Skips to Arrive at Meeting On Time

Solve the problem of minimizing skips while traveling to arrive on time, using dynamic programming and state transitions…

Hard
1886

Determine Whether Matrix Can Be Obtained By Rotation

Determine if a binary matrix can be transformed into another by rotating it 90 degrees multiple times.

Easy
1887

Reduction Operations to Make the Array Elements Equal

Find the minimum number of operations to make all array elements equal by reducing the largest elements to the next smal…

Medium
1889

Minimum Space Wasted From Packaging

Minimize the wasted space when packaging items into boxes, considering package and box size constraints.

Hard
1893

Check if All the Integers in a Range Are Covered

Check if all integers in the range [left, right] are covered by intervals in a given set of ranges.

Easy
1894

Find the Student that Will Replace the Chalk

Identify the first student who will run out of chalk using a simulation with prefix sums and binary search.

Medium
1895

Largest Magic Square

Find the side length of the largest magic square in a matrix where row, column, and diagonal sums are equal.

Medium
1898

Maximum Number of Removable Characters

Use binary search and a subsequence check to find the largest removable prefix that still keeps p inside s.

Medium
1899

Merge Triplets to Form Target Triplet

Determine if target triplet can be formed by merging given triplets using greedy selection and invariant checks.

Medium
1901

Find a Peak Element II

Locate any peak in a 2D matrix using binary search across rows or columns for efficient discovery and verification.

Medium
1905

Count Sub Islands

Identify and count all islands in grid2 that are fully contained within islands of grid1 using DFS traversal efficiently…

Medium
1906

Minimum Absolute Difference Queries

Compute minimum absolute differences for subarrays efficiently using array scanning and hash table lookups, leveraging b…

Medium
1909

Remove One Element to Make the Array Strictly Increasing

Determine if removing a single element from an array can make it strictly increasing, using a careful index check approa…

Easy
1911

Maximum Alternating Subsequence Sum

Maximize alternating subsequence sum with dynamic programming and state transitions in an array.

Medium
1912

Design Movie Rental System

Implement a movie rental system with efficient search, rent, drop, and report operations using arrays and hash lookups.

Hard
1913

Maximum Product Difference Between Two Pairs

Find the maximum product difference between two pairs in an integer array using sorting for optimal selection.

Easy
1914

Cyclically Rotating a Grid

This problem requires cyclically rotating a grid by rotating each layer of the matrix counter-clockwise for a specified …

Medium
1920

Build Array from Permutation

The problem asks to build an array from a given permutation using an efficient approach.

Easy
1921

Eliminate Maximum Number of Monsters

Eliminate monsters by strategically using a weapon in a video game to stop them before they reach your city.

Medium
1923

Longest Common Subpath

The Longest Common Subpath problem requires finding the longest subpath shared by all paths in a graph using binary sear…

Hard
1926

Nearest Exit from Entrance in Maze

Find the shortest path from the maze entrance to the nearest border exit using BFS over a 2D array matrix efficiently.

Medium
1928

Minimum Cost to Reach Destination in Time

Minimize the travel cost in a graph while adhering to a time constraint using state transition dynamic programming.

Hard
1929

Concatenation of Array

This problem asks you to create an array of double the size, where each element is repeated twice in sequence.

Easy
1936

Add Minimum Number of Rungs

Determine the fewest rungs to add to climb a strictly increasing ladder using a greedy step-by-step approach.

Medium
1937

Maximum Number of Points with Cost

Maximize your points in a matrix by selecting cells row by row while accounting for distance penalties using dynamic pro…

Medium
1938

Maximum Genetic Difference Query

Find the maximum genetic difference along paths in a tree using array scanning and hash lookups with XOR calculations.

Hard
1942

The Number of the Smallest Unoccupied Chair

Solve The Number of the Smallest Unoccupied Chair by sorting arrivals and managing freed seats before each new assignmen…

Medium
1943

Describe the Painting

Solve the problem of describing a painted segment with mixed colors using array scanning and hash table lookups.

Medium
1944

Number of Visible People in a Queue

Compute how many people each person in a queue can see to their right using efficient stack-based state management.

Hard
1946

Largest Number After Mutating Substring

Find the largest integer by mutating a substring of a number using a mapping array for each digit.

Medium
1947

Maximum Compatibility Score Sum

Assign students to mentors to maximize total compatibility using state transition dynamic programming with bitmask optim…

Medium
1948

Delete Duplicate Folders in System

Solve Delete Duplicate Folders in System by building a trie, serializing child subtrees, and deleting repeated non-empty…

Hard
1953

Maximum Number of Weeks for Which You Can Work

Maximize the number of weeks you can work on projects with milestone constraints using a greedy approach and invariant v…

Medium
1955

Count Number of Special Subsequences

Learn to count all valid special subsequences in an array using state transition dynamic programming efficiently and cor…

Hard
1958

Check if Move is Legal

Determine if a move on an 8x8 board is legal by validating lines in all directions using array and matrix patterns.

Medium
1959

Minimum Total Space Wasted With K Resizing Operations

Find the minimum total space wasted in a dynamic array with at most k resizing operations.

Medium
1961

Check If String Is a Prefix of Array

Determine if a string is a prefix of an array by concatenating initial elements, using two-pointer scanning efficiently.

Easy
1962

Remove Stones to Minimize the Total

Minimize the total stones by repeatedly removing half from the largest pile using a greedy heap strategy.

Medium
1964

Find the Longest Valid Obstacle Course at Each Position

Compute the longest valid obstacle course at each position using binary search and careful array tracking techniques eff…

Hard
1967

Number of Strings That Appear as Substrings in Word

Count how many strings in an array appear as substrings within a given word by checking each pattern individually.

Easy
1968

Array With Elements Not Equal to Average of Neighbors

Rearrange an array such that no element equals the average of its neighbors using a greedy approach.

Medium
1970

Last Day Where You Can Still Cross

Find the last day to walk from top to bottom in a flooded matrix by using binary search and graph traversal techniques.

Hard
1975

Maximum Matrix Sum

Maximize the sum of an n x n integer matrix using row and column negation operations efficiently with a greedy approach.

Medium
1979

Find Greatest Common Divisor of Array

Find the greatest common divisor of the smallest and largest numbers in an integer array.

Easy
1980

Find Unique Binary String

Find a binary string of length n not in the input array using array scanning and hash lookup efficiently.

Medium
1981

Minimize the Difference Between Target and Chosen Elements

This problem asks to select one element per row to minimize the absolute difference from a target sum using dynamic prog…

Medium
1982

Find Array Given Subset Sums

Reconstruct an array from given subset sums using divide and conquer approach and leveraging array properties.

Hard
1984

Minimum Difference Between Highest and Lowest of K Scores

Minimize the difference between the highest and lowest of k student scores using a sliding window approach.

Easy
1985

Find the Kth Largest Integer in the Array

This problem asks to find the kth largest integer in an array of string numbers, highlighting sorting and string-based c…

Medium
1986

Minimum Number of Work Sessions to Finish the Tasks

Find the minimum number of work sessions needed to finish a set of tasks, considering task durations and session time.

Medium
1991

Find the Middle Index in Array

Find the smallest middle index where the sum of elements on the left equals the sum on the right using prefix sums effic…

Easy
1992

Find All Groups of Farmland

Identify all rectangular farmland groups in a binary matrix using array traversal and depth-first search efficiently.

Medium
1993

Operations on Tree

Design a tree data structure that allows locking, unlocking, and upgrading nodes with user-specific actions.

Medium
1994

The Number of Good Subsets

Find the number of good subsets in an integer array, where each subset's product is the product of distinct primes.

Hard
1995

Count Special Quadruplets

Count Special Quadruplets requires scanning arrays and using hash lookups to efficiently find quadruplets matching sum c…

Easy
1996

The Number of Weak Characters in the Game

Identify all weak characters in a game by analyzing attack and defense values using a stack-based greedy sorting approac…

Medium
1997

First Day Where You Have Been in All the Rooms

Calculate the first day you have visited all rooms using state transition dynamic programming on the nextVisit array.

Medium
1998

GCD Sort of an Array

The GCD Sort problem challenges you to sort an array using a specific gcd-based swap method.

Hard
2001

Number of Pairs of Interchangeable Rectangles

Count all pairs of rectangles that share the exact width-to-height ratio using efficient array scanning and hash lookup.

Medium
2006

Count Number of Pairs With Absolute Difference K

Find how many pairs (i, j) with i < j satisfy |nums[i] - nums[j]| == k using array scanning and hash lookup.

Easy
2007

Find Original Array From Doubled Array

Given a shuffled array, determine if it is a doubled array and find the original array.

Medium
2008

Maximum Earnings From Taxi

Maximize earnings by optimizing taxi ride selection and tips using array scanning, hash lookups, and sorting.

Medium
2009

Minimum Number of Operations to Make Array Continuous

Find the minimum number of operations to make an array continuous by modifying elements using array scanning and hash lo…

Hard
2011

Final Value of Variable After Performing Operations

Compute the final value of X by simulating each string operation in the array sequentially with careful tracking.

Easy
2012

Sum of Beauty in the Array

Calculate the sum of beauty for array elements using prefix and suffix tracking to optimize evaluation across indices ef…

Medium
2013

Detect Squares

Detect Squares requires tracking points on a 2D plane to quickly count all possible axis-aligned squares using efficient…

Medium
2016

Maximum Difference Between Increasing Elements

Find the maximum difference between two increasing elements in an array using a linear scan to track the minimum value e…

Easy
2017

Grid Game

Solve the Grid Game problem by optimizing the movement of two robots on a 2D matrix grid.

Medium
2018

Check if Word Can Be Placed In Crossword

Determine if a word fits in a crossword grid using array and matrix checks, accounting for spaces, letters, and blocked …

Medium
2019

The Score of Students Solving Math Expression

Calculate student scores for a single-digit math expression using state transition dynamic programming to track all vali…

Hard
2022

Convert 1D Array Into 2D Array

Convert a 1D integer array into a structured 2D array with specified rows and columns using all elements sequentially.

Easy
2023

Number of Pairs of Strings With Concatenation Equal to Target

Count all unique index pairs in a string array whose concatenation exactly matches the given target string using efficie…

Medium
2025

Maximum Number of Ways to Partition an Array

Determine the maximum number of ways to split an array into equal sums using at most one element change, leveraging pref…

Hard
2028

Find Missing Observations

Given a set of dice rolls, calculate the missing observations based on the mean and return them or determine if it's imp…

Medium
2029

Stone Game IX

In the Stone Game IX problem, Alice and Bob take turns removing stones, and Alice wins if the sum of removed stones is d…

Medium
2032

Two Out of Three

Identify all elements appearing in at least two of three arrays using efficient scanning and hash lookups for fast verif…

Easy
2033

Minimum Operations to Make a Uni-Value Grid

Determine the fewest additions or subtractions of x to make all grid elements identical using array and math logic.

Medium
2035

Partition Array Into Two Arrays to Minimize Sum Difference

Partition an integer array into two equal halves to minimize the absolute difference of their sums using dynamic program…

Hard
2037

Minimum Number of Moves to Seat Everyone

Calculate the minimum total moves to seat each student using greedy assignment and invariant validation efficiently.

Easy
2039

The Time When the Network Becomes Idle

Calculate the time when the network becomes idle, factoring in message resending and the BFS traversal method.

Medium
2040

Kth Smallest Product of Two Sorted Arrays

Find the kth smallest product from two sorted arrays using binary search across possible product values efficiently.

Hard
2043

Simple Bank System

Design a simple bank system that processes transactions like withdrawals, deposits, and transfers while managing account…

Medium
2044

Count Number of Maximum Bitwise-OR Subsets

Determine the number of non-empty subsets that achieve the maximum bitwise OR using efficient backtracking and pruning s…

Medium
2049

Count Nodes With the Highest Score

Find the number of nodes with the highest score in a binary tree, based on subtree sizes and node removal.

Medium
2050

Parallel Courses III

Solve Parallel Courses III by finding the minimum number of months to complete all courses using graph-based topological…

Hard
2053

Kth Distinct String in an Array

Find the kth distinct string in an array by identifying strings that appear only once, using efficient array scanning an…

Easy
2054

Two Best Non-Overlapping Events

Maximize the total value of at most two non-overlapping events using state transition dynamic programming efficiently.

Medium
2055

Plates Between Candles

Determine the number of plates between candles in a given substring using binary search and prefix sum techniques.

Medium
2056

Number of Valid Move Combinations On Chessboard

Given a set of pieces on a chessboard, calculate the number of valid move combinations without overlap using backtrackin…

Hard
2057

Smallest Index With Equal Value

Find the smallest index where the index mod 10 equals the value at that index in the given array.

Easy
2059

Minimum Operations to Convert Number

Determine the minimum operations needed to convert a number using array elements with addition, subtraction, or XOR oper…

Medium
2064

Minimized Maximum of Products Distributed to Any Store

Distribute products to stores so the largest store allocation is minimized using binary search over possible maximums.

Medium
2065

Maximum Path Quality of a Graph

Calculate the maximum path quality in a graph using backtracking and pruning to optimize node visits within time limits …

Hard
2070

Most Beautiful Item for Each Query

Determine the maximum beauty of items affordable for each query using efficient binary search and sorting techniques.

Medium
2071

Maximum Number of Tasks You Can Assign

Maximize the number of tasks that can be completed by efficiently using workers and magical pills.

Hard
2073

Time Needed to Buy Tickets

Calculate the total time for a specific person to buy all their tickets using queue-driven state processing.

Easy
2078

Two Furthest Houses With Different Colors

Maximize the distance between two houses with different colors by using a greedy approach and validating the choice.

Easy
2079

Watering Plants

Simulate watering plants while managing a watering can's capacity, considering distance and refills.

Medium
2080

Range Frequency Queries

Design a data structure to handle efficient frequency queries for subarrays, focusing on hash-based lookups and efficien…

Medium
2085

Count Common Words With One Occurrence

Learn how to efficiently count strings appearing exactly once in both arrays using array scanning and hash lookup patter…

Easy
2087

Minimum Cost Homecoming of a Robot in a Grid

Find the minimum cost for a robot to return home in a grid with row and column movement costs.

Medium
2088

Count Fertile Pyramids in a Land

Solve Count Fertile Pyramids in a Land with matrix DP that measures the tallest pyramid rooted at each fertile cell.

Hard
2089

Find Target Indices After Sorting Array

Find the target indices of a sorted array and return them in increasing order using binary search and sorting techniques…

Easy
2090

K Radius Subarray Averages

Efficiently calculate the k-radius average for subarrays using sliding window technique.

Medium
2091

Removing Minimum and Maximum From Array

The problem asks to remove the minimum and maximum elements from an array with the fewest deletions.

Medium
2094

Finding 3-Digit Even Numbers

Generate unique 3-digit even numbers from a given array of digits with duplicates.

Easy
2099

Find Subsequence of Length K With the Largest Sum

Pick the k largest values, then restore their original order to build the maximum-sum subsequence correctly.

Easy
2100

Find Good Days to Rob the Bank

Find good days to rob the bank by identifying days with non-increasing and non-decreasing guard counts using dynamic pro…

Medium
2101

Detonate the Maximum Bombs

Determine the maximum number of bombs that can be detonated by leveraging chain reactions using graph traversal and DFS …

Medium
2104

Sum of Subarray Ranges

Compute the total sum of ranges for all contiguous subarrays efficiently using stack-based state management techniques.

Medium
2105

Watering Plants II

Simulate watering a row of plants with Alice and Bob using two-pointer scanning, tracking refills precisely for each ste…

Medium
2106

Maximum Fruits Harvested After at Most K Steps

Compute the maximum fruits collectable on an infinite line by moving at most k steps from a start position efficiently.

Hard
2108

Find First Palindromic String in the Array

Return the first palindromic string from an array of words or an empty string if none exists.

Easy
2109

Adding Spaces to a String

Learn to efficiently insert spaces in a string using two-pointer scanning with invariant tracking in linear time.

Medium
2110

Number of Smooth Descent Periods of a Stock

Count all contiguous periods where stock prices descend smoothly by exactly one using dynamic programming techniques.

Medium
2111

Minimum Operations to Make the Array K-Increasing

This problem requires finding the minimum number of operations to make an array K-increasing using binary search over th…

Hard
2114

Maximum Number of Words Found in Sentences

Find the maximum number of words in a single sentence from an array of sentences using array and string processing techn…

Easy
2115

Find All Possible Recipes from Given Supplies

Determine all recipes you can prepare given initial supplies and ingredient dependencies, leveraging array scanning and …

Medium
2121

Intervals Between Identical Elements

Solve the problem of calculating intervals between identical elements using array scanning and hash lookup.

Medium
2122

Recover the Original Array

Recover the Original Array helps you understand how to reverse-engineer an array from two subsets using array scanning a…

Hard
2125

Number of Laser Beams in a Bank

Calculate total laser beams in a bank floor plan using array counting and math logic between security devices on differe…

Medium
2126

Destroying Asteroids

This problem requires destroying asteroids by choosing the right order of collisions based on mass, using a greedy appro…

Medium
2131

Longest Palindrome by Concatenating Two Letter Words

Find the maximum-length palindrome by combining two-letter words using array scanning and hash table lookups efficiently…

Medium
2132

Stamping the Grid

Determine if a binary grid can be fully covered using fixed-size stamps by applying a greedy placement and validation st…

Hard
2133

Check if Every Row and Column Contains All Numbers

Determine if every row and column in a square matrix contains all numbers from 1 to n without repetition using array sca…

Easy
2134

Minimum Swaps to Group All 1's Together II

Solve the minimum swaps to group all 1's together in a circular binary array using an optimized sliding window approach.

Medium
2135

Count Words Obtained After Adding a Letter

Given startWords and targetWords, check how many targetWords can be formed by adding one letter and rearranging letters …

Medium
2136

Earliest Possible Day of Full Bloom

Find the earliest day where all flower seeds are blooming based on their planting and growth times, using a greedy strat…

Hard
2140

Solving Questions With Brainpower

Maximize points in an exam with state transition dynamic programming by deciding whether to solve or skip each question.

Medium
2141

Maximum Running Time of N Computers

Solve the problem of determining the maximum running time of n computers using a set of batteries.

Hard
2144

Minimum Cost of Buying Candies With Discount

Minimize the total cost of buying candies using a greedy approach with a discount system based on candy prices.

Easy
2145

Count the Hidden Sequences

Given a sequence of differences, count how many hidden sequences fit within a range using an array and prefix sum approa…

Medium
2146

K Highest Ranked Items Within a Price Range

Use BFS to rank reachable shop items by distance, price, row, and column, then return the best k coordinates.

Medium
2148

Count Elements With Strictly Smaller and Greater Elements

Count elements in an array that have both strictly smaller and strictly greater numbers using array sorting efficiently.

Easy
2149

Rearrange Array Elements by Sign

Rearrange an array by alternating positive and negative integers using a two-pointer approach with invariant tracking.

Medium
2150

Find All Lonely Numbers in the Array

Find lonely numbers in an array where each lonely number appears once and has no adjacent values.

Medium
2151

Maximum Good People Based on Statements

Determine the maximum number of good people in a group given mutual statements, using precise backtracking with pruning.

Hard
2154

Keep Multiplying Found Values by Two

The "Keep Multiplying Found Values by Two" problem involves repeatedly multiplying a number by two if it is found in an …

Easy
2155

All Divisions With the Highest Score of a Binary Array

Find all indices in a binary array where division score is maximized.

Medium
2161

Partition Array According to Given Pivot

Rearrange an array around a pivot while maintaining relative order using a two-pointer scanning approach efficiently.

Medium
2163

Minimum Difference in Sums After Removal of Elements

Minimize the difference between sums after removing n elements from a 3n array by dividing the remaining elements into t…

Hard
2164

Sort Even and Odd Indices Independently

Rearrange a 0-indexed array by sorting even and odd indices independently for predictable order and correctness.

Easy
2166

Design Bitset

Master the Design Bitset problem by efficiently managing bit flips, counts, and indexed updates with array and hash look…

Medium
2170

Minimum Operations to Make the Array Alternating

Given an array, calculate the minimum number of operations needed to make it alternating.

Medium
2171

Removing Minimum Number of Magic Beans

Determine the minimum beans to remove so all remaining non-empty bags have equal beans using a greedy approach.

Medium
2172

Maximum AND Sum of Array

Find the maximum AND sum by placing integers into limited slots using state transition dynamic programming efficiently.

Hard
2176

Count Equal and Divisible Pairs in an Array

Given an array, count pairs of elements that are equal and their indices product is divisible by a given integer.

Easy
2179

Count Good Triplets in an Array

Count Good Triplets in an Array requires tracking index orders across two permutations efficiently using binary search.

Hard
2183

Count Array Pairs Divisible by K

Count Array Pairs Divisible by K requires counting index pairs whose products are divisible by a given number k.

Hard
2185

Counting Words With a Given Prefix

Count how many words in a list start with a given prefix.

Easy
2187

Minimum Time to Complete Trips

Find the minimum time required for buses to complete at least totalTrips using binary search over time multiples.

Medium
2188

Minimum Time to Finish the Race

Minimize the time to complete a race with tire swaps using dynamic programming and state transitions.

Hard
2190

Most Frequent Number Following Key In an Array

Scan the array once, count which value appears right after the key, and return the uniquely most frequent follower.

Easy
2191

Sort the Jumbled Numbers

Sort numbers based on a custom mapping of their digits, leveraging array manipulation and sorting techniques.

Medium
2195

Append K Integers With Minimal Sum

In this problem, you need to append k unique positive integers to a given array nums such that the sum is minimized.

Medium
2196

Create Binary Tree From Descriptions

Build a binary tree from descriptions of parent-child relationships using array scanning and hash lookup.

Medium
2197

Replace Non-Coprime Numbers in Array

Replace Non-Coprime Numbers in Array uses stack-based state management to iteratively merge adjacent non-coprime integer…

Hard
2200

Find All K-Distant Indices in an Array

Identify all indices in an array that are within k distance of elements equal to the given key using two-pointer scannin…

Easy
2201

Count Artifacts That Can Be Extracted

Count the number of artifacts that can be extracted after excavating specified grid cells.

Medium
2202

Maximize the Topmost Element After K Moves

Maximize the topmost element in a pile after making exactly k moves using a greedy strategy and invariant checks.

Medium
2206

Divide Array Into Equal Pairs

Determine if an array of 2n integers can be partitioned into n pairs where each pair contains identical elements using h…

Easy
2208

Minimum Operations to Halve Array Sum

Minimize operations to halve an array's sum using greedy choices and heap data structures.

Medium
2210

Count Hills and Valleys in an Array

Count Hills and Valleys in an Array determines the number of hills and valleys in a given array by analyzing index neigh…

Easy
2212

Maximum Points in an Archery Competition

In the "Maximum Points in an Archery Competition" problem, Bob aims to maximize his score while respecting Alice's arrow…

Medium
2213

Longest Substring of One Repeating Character

Solve Longest Substring of One Repeating Character by maintaining mergeable run information under character updates afte…

Hard
2215

Find the Difference of Two Arrays

Find the Difference of Two Arrays helps you identify unique elements between two integer arrays using array scanning and…

Easy
2216

Minimum Deletions to Make Array Beautiful

Determine the minimum deletions required to transform an array into a beautiful sequence using stack-based state managem…

Medium
2217

Find Palindrome With Fixed Length

Find the smallest palindromes of a given length for specific queries with mathematical and array manipulation.

Medium
2218

Maximum Value of K Coins From Piles

Optimize coin selection across multiple piles using state transition dynamic programming to achieve the maximum wallet v…

Hard
2221

Find Triangular Sum of an Array

The problem asks for calculating the triangular sum of an array through repeated pairwise summation.

Medium
2225

Find Players With Zero or One Losses

Identify players with zero or one losses by efficiently scanning arrays and counting losses using hash lookups for accur…

Medium
2226

Maximum Candies Allocated to K Children

Maximize candies allocation for k children by dividing piles into sub-piles using binary search.

Medium
2227

Encrypt and Decrypt Strings

The 'Encrypt and Decrypt Strings' problem involves creating a data structure that can encrypt and decrypt strings using …

Hard
2233

Maximum Product After K Increments

Maximize the product of an array after performing up to k increments using a greedy approach with heap optimization.

Medium
2234

Maximum Total Beauty of the Gardens

Determine the maximum total beauty of gardens by strategically planting flowers using binary search over achievable flow…

Hard
2239

Find Closest Number to Zero

Identify the number in an integer array that is closest to zero, returning the larger one if tied.

Easy
2241

Design an ATM Machine

Design an ATM machine that stores and withdraws money with given denominations and prioritizes larger values during with…

Medium
2242

Maximum Score of a Node Sequence

Find the maximum score of a valid node sequence in an undirected graph with given node scores and edges.

Hard
2244

Minimum Rounds to Complete All Tasks

The problem requires finding the minimum rounds to complete tasks, focusing on greedy algorithms and hash table lookups.

Medium
2245

Maximum Trailing Zeros in a Cornered Path

Find the maximum trailing zeros in the product of a cornered path within a 2D grid.

Medium
2246

Longest Path With Different Adjacent Characters

Find the longest path in a tree where adjacent nodes have different characters using graph DFS and topological reasoning…

Hard
2248

Intersection of Multiple Arrays

Find integers that are common across all arrays in a given list of arrays.

Easy
2249

Count Lattice Points Inside a Circle

Count the number of lattice points inside at least one circle in a grid, based on given center and radius data.

Medium
2250

Count Number of Rectangles Containing Each Point

Given a set of rectangles and points, determine how many rectangles contain each point.

Medium
2251

Number of Flowers in Full Bloom

Find the number of flowers in full bloom at the given times for a list of people.

Hard
2255

Count Prefixes of a Given String

Count Prefixes of a Given String is a problem that involves finding the number of string prefixes in an array that match…

Easy
2256

Minimum Average Difference

Find the index with the minimum average difference in an array using prefix sums.

Medium
2257

Count Unguarded Cells in the Grid

Solve Count Unguarded Cells in the Grid by marking guard sight lines across a blocked matrix and counting untouched empt…

Medium
2258

Escape the Spreading Fire

Maximize the time you can stay at your starting position before moving to safely reach the safehouse while avoiding fire…

Hard
2260

Minimum Consecutive Cards to Pick Up

Solve Minimum Consecutive Cards to Pick Up by tracking each card's last index and minimizing duplicate spans during one …

Medium
2261

K Divisible Elements Subarrays

Count all distinct subarrays with at most k elements divisible by p using array scanning and hash lookup techniques effi…

Medium
2267

Check if There Is a Valid Parentheses String Path

Check if there exists a valid parentheses string path in a given grid using state transition dynamic programming.

Hard
2270

Number of Ways to Split Array

Count all valid ways to split a 0-indexed integer array into two non-empty parts using array plus prefix sum logic effic…

Medium
2271

Maximum White Tiles Covered by a Carpet

Solve Maximum White Tiles Covered by a Carpet by sorting intervals, checking optimal carpet starts, and counting full pl…

Medium
2272

Substring With Largest Variance

Find the largest variance possible in any substring of a given string using dynamic programming.

Hard
2273

Find Resultant Array After Removing Anagrams

This problem requires removing adjacent anagrams from a list of words using an array scanning and hash lookup approach.

Easy
2274

Maximum Consecutive Floors Without Special Floors

Find the maximum sequence of consecutive floors without any special floors using array sorting techniques efficiently.

Medium
2275

Largest Combination With Bitwise AND Greater Than Zero

Find the largest group of integers in an array whose bitwise AND is greater than zero using array scanning and hash look…

Medium
2279

Maximum Bags With Full Capacity of Rocks

Maximize the number of bags filled to capacity by distributing additional rocks using a greedy approach.

Medium
2280

Minimum Lines to Represent a Line Chart

Determine the fewest lines needed to accurately connect stock price points in a line chart using array and math reasonin…

Medium
2281

Sum of Total Strength of Wizards

The Sum of Total Strength of Wizards problem asks for the sum of the total strengths of all contiguous subarrays of wiza…

Hard
2284

Sender With Largest Word Count

Find the sender with the largest total word count by scanning messages and tallying counts using a hash table efficientl…

Medium
2289

Steps to Make Array Non-decreasing

Determine the minimum steps to make an array non-decreasing using linked-list pointer manipulation and monotonic stack t…

Medium
2290

Minimum Obstacle Removal to Reach Corner

Find the minimum obstacles to remove in a 2D grid to reach the bottom-right corner using BFS graph traversal techniques.

Hard
2293

Min Max Game

The Min Max Game problem requires simulating an array reduction process to find the last remaining number.

Easy
2294

Partition Array Such That Maximum Difference Is K

Find the minimum number of subsequences required such that the difference between the maximum and minimum value in each …

Medium
2295

Replace Elements in an Array

Replace Elements in an Array involves applying a series of operations to replace values in an array with new ones based …

Medium
2300

Successful Pairs of Spells and Potions

Count how many potions pair successfully with each spell using binary search over sorted potion strengths efficiently.

Medium
2301

Match Substring After Replacement

Determine if a target substring can appear in a string after optional character replacements using given mappings effici…

Hard
2302

Count Subarrays With Score Less Than K

Count all non-empty subarrays whose score, defined as sum times length, is strictly less than a given integer k efficien…

Hard
2303

Calculate Amount Paid in Taxes

Calculate the total tax owed by iterating through sorted brackets and applying each rate incrementally to your income.

Easy
2304

Minimum Path Cost in a Grid

Minimize the cost of a path in a grid while considering move costs for each step.

Medium
2305

Fair Distribution of Cookies

The problem focuses on fairly distributing cookies among children to minimize the maximum unfairness of the distribution…

Medium
2306

Naming a Company

The "Naming a Company" problem requires determining the number of valid distinct company names from a list of name ideas…

Hard
2312

Selling Pieces of Wood

Maximize your profit by cutting a wooden piece into smaller parts based on given prices and dimensions.

Hard
2317

Maximum XOR After Operations

Maximize the bitwise XOR of an array after applying a special operation with non-negative integers multiple times.

Medium
2319

Check if Matrix Is X-Matrix

Check if a square matrix follows the X-Matrix pattern by validating diagonal and non-diagonal conditions.

Easy
2321

Maximum Score Of Spliced Array

Maximize the score of two arrays by splicing and swapping a subarray using dynamic programming.

Hard
2322

Minimum Score After Removals on a Tree

Compute the minimum score after removing two edges in a tree using DFS and XOR-based component tracking efficiently.

Hard
2326

Spiral Matrix IV

In this problem, you need to generate a matrix filled with values from a linked list in a spiral order.

Medium
2328

Number of Increasing Paths in a Grid

Solve Number of Increasing Paths in a Grid by turning cell comparisons into a DAG and counting paths with topological DP…

Hard
2332

The Latest Time to Catch a Bus

Find the latest time to catch a bus based on departure times, passenger arrivals, and capacity using binary search over …

Medium
2333

Minimum Sum of Squared Difference

Calculate the minimum sum of squared differences between two arrays using limited modifications and binary search techni…

Medium
2334

Subarray With Elements Greater Than Varying Threshold

Find the size of a subarray with all elements greater than threshold divided by length using stack-based state managemen…

Hard
2335

Minimum Amount of Time to Fill Cups

Determine the minimum seconds to fill cups of cold, warm, and hot water using a greedy selection strategy and invariant …

Easy
2341

Maximum Number of Pairs in Array

Given an array, count how many pairs can be formed and how many leftovers remain after pairing.

Easy
2342

Max Sum of a Pair With Equal Sum of Digits

Find the maximum sum of two numbers with equal digit sums in a given array of positive integers.

Medium
2343

Query Kth Smallest Trimmed Number

Solve the Query Kth Smallest Trimmed Number problem by efficiently trimming and sorting strings in an array to answer qu…

Medium
2344

Minimum Deletions to Make Array Divisible

Find the minimum number of deletions to make the smallest element in nums divide all elements of numsDivide.

Hard
2347

Best Poker Hand

Determine the strongest poker hand from five cards using array scanning and hash table counting techniques efficiently.

Easy
2348

Number of Zero-Filled Subarrays

Given an array of integers, count the subarrays that consist entirely of 0s.

Medium
2350

Shortest Impossible Sequence of Rolls

Find the shortest subsequence that cannot be formed from a sequence of dice rolls, with efficient array scanning and has…

Hard
2352

Equal Row and Column Pairs

Identify all pairs of rows and columns in a square matrix that contain identical elements in the same sequence efficient…

Medium
2353

Design a Food Rating System

Design a food rating system that tracks and updates ratings of foods, finding the highest rated items by cuisine.

Medium
2354

Number of Excellent Pairs

Calculate the number of excellent pairs in an array using bit counting, hash sets, and efficient pair scanning technique…

Hard
2357

Make Array Zero by Subtracting Equal Amounts

Minimize operations to make all array elements zero by subtracting equal amounts in each operation.

Easy
2358

Maximum Number of Groups Entering a Competition

Determine the maximum number of ordered non-empty student groups for a competition using grades array analysis and binar…

Medium
2363

Merge Similar Items

Merge Similar Items combines values and weights from two lists, returning the result sorted by value.

Easy
2364

Count Number of Bad Pairs

Count the number of bad pairs in an array where the difference between indices and values does not match.

Medium
2365

Task Scheduler II

Complete tasks in the optimal number of days by considering breaks and task type constraints.

Medium
2366

Minimum Replacements to Sort the Array

Minimize the number of operations to make the array sorted in non-decreasing order by replacing elements with sums of tw…

Hard
2367

Number of Arithmetic Triplets

Count the number of arithmetic triplets in a given strictly increasing array with a specified difference.

Easy
2368

Reachable Nodes With Restrictions

In the 'Reachable Nodes With Restrictions' problem, find the maximum reachable nodes from node 0 in a tree while avoidin…

Medium
2369

Check if There is a Valid Partition For The Array

This problem challenges you to determine if an array can be partitioned into valid subarrays using dynamic programming.

Medium
2373

Largest Local Values in a Matrix

Find the largest value in every 3x3 submatrix of an n x n integer matrix efficiently using nested loops.

Easy
2381

Shifting Letters II

Shift letters in a string using a sequence of range-based forward or backward operations efficiently with prefix sums.

Medium
2382

Maximum Segment Sum After Removals

Calculate the maximum segment sum after sequential removals using array plus union find for efficient merging of segment…

Hard
2383

Minimum Hours of Training to Win a Competition

Find the minimum hours of training needed to beat all opponents in a competition based on energy and experience.

Easy
2386

Find the K-Sum of an Array

Find the K-Sum of an Array requires computing the kth largest subsequence sum in an array using sorting and heap techniq…

Hard
2389

Longest Subsequence With Limited Sum

Find the maximum size of a subsequence from nums with a sum less than or equal to each query value.

Easy
2391

Minimum Amount of Time to Collect Garbage

This problem asks you to find the minimum amount of time needed to collect all garbage in a city, focusing on array and …

Medium
2392

Build a Matrix With Conditions

Solve the matrix-building problem by using graph indegree and topological sorting to satisfy given row and column constr…

Hard
2395

Find Subarrays With Equal Sum

Find Subarrays With Equal Sum is solved by scanning adjacent pairs and storing each length-2 sum in a hash set.

Easy
2397

Maximum Rows Covered by Columns

Select exactly numSelect columns from a binary matrix to maximize rows where all ones are covered efficiently using back…

Medium
2398

Maximum Number of Robots Within Budget

Determine the maximum number of consecutive robots you can operate without exceeding a given budget using efficient bina…

Hard
2399

Check Distances Between Same Letters

Verify if each pair of identical letters in a string has the exact number of letters between them as specified in a dist…

Easy
2401

Longest Nice Subarray

Find the length of the longest nice subarray where the bitwise AND of all pairs of elements in the subarray is zero.

Medium
2402

Meeting Rooms III

Determine which meeting room holds the most meetings by simulating room assignments with precise time tracking.

Hard
2404

Most Frequent Even Element

Identify the most frequent even element in an array using counting and hash lookup, handling ties by choosing the smalle…

Easy
2406

Divide Intervals Into Minimum Number of Groups

Determine the minimum number of non-overlapping groups for a set of intervals using precise two-pointer scanning logic.

Medium
2407

Longest Increasing Subsequence II

Determine the longest increasing subsequence in an array where consecutive elements differ by at most k using dynamic pr…

Hard
2410

Maximum Matching of Players With Trainers

Maximize the number of valid player-trainer matchings using two-pointer scanning and careful sorting strategy.

Medium
2411

Smallest Subarrays With Maximum Bitwise OR

Find the smallest subarrays with the maximum bitwise OR for each starting index in an array.

Medium
2412

Minimum Money Required Before Transactions

Find the minimum money required to complete all transactions in any order while considering cost and cashback.

Hard
2416

Sum of Prefix Scores of Strings

The 'Sum of Prefix Scores of Strings' problem involves calculating prefix scores for strings based on their occurrences …

Hard
2418

Sort the People

Sort the People requires pairing names with heights and sorting them in descending height order efficiently using arrays…

Easy
2419

Longest Subarray With Maximum Bitwise AND

Find the length of the longest subarray whose bitwise AND reaches the array's maximum value, combining array scanning wi…

Medium
2420

Find All Good Indices

Identify all indices in an array where the k-length prefix is non-increasing and the k-length suffix is non-decreasing.

Medium
2421

Number of Good Paths

Count all good paths in a tree by scanning node values and using hash maps to track valid connections efficiently.

Hard
2425

Bitwise XOR of All Pairings

Compute the overall bitwise XOR from all pairings between two arrays using efficient array and bit manipulation techniqu…

Medium
2426

Number of Pairs Satisfying Inequality

Count pairs in two arrays satisfying a given inequality condition using binary search over the valid answer space.

Hard
2428

Maximum Sum of an Hourglass

Calculate the maximum sum of an hourglass in a 2D matrix using array traversal and submatrix evaluation techniques effic…

Medium
2432

The Employee That Worked on the Longest Task

Identify which employee spent the longest time on a task using an array-driven approach, analyzing each log entry effici…

Easy
2433

Find The Original Array of Prefix Xor

Find the original array from a given prefix XOR array using bitwise manipulation techniques.

Medium
2435

Paths in Matrix Whose Sum Is Divisible by K

Compute all paths in a matrix where the sum of elements is divisible by k using state transition dynamic programming eff…

Hard
2438

Range Product Queries of Powers

The Range Product Queries of Powers problem requires calculating the product of powers of 2 for a range of queries on a …

Medium
2439

Minimize Maximum of Array

Minimize Maximum of Array involves finding the smallest possible maximum value after applying a series of operations on …

Medium
2440

Create Components With Same Value

Maximize the number of components in a tree with equal sums by carefully deleting edges using divisor-based logic.

Hard
2441

Largest Positive Integer That Exists With Its Negative

Find the largest positive integer in an array such that its negative counterpart also exists.

Easy
2442

Count Number of Distinct Integers After Reverse Operations

This problem requires counting distinct integers after performing reverse operations on each integer in an array.

Medium
2444

Count Subarrays With Fixed Bounds

Count all subarrays where the minimum and maximum match given bounds using efficient sliding window tracking techniques.

Hard
2446

Determine if Two Events Have Conflict

Compare two same-day time intervals and check whether their inclusive endpoints overlap after converting HH:MM strings i…

Easy
2447

Number of Subarrays With GCD Equal to K

Count the number of subarrays with GCD equal to a given value k from a list of integers.

Medium
2448

Minimum Cost to Make Array Equal

Find the minimum cost to make all elements of an array equal by using binary search over valid answers.

Hard
2449

Minimum Number of Operations to Make Arrays Similar

Determine the minimum operations to make two arrays similar by adjusting pairs while respecting element frequencies and …

Hard
2451

Odd String Difference

Identify the one string in an array whose consecutive letter differences deviate from all others using array scanning pl…

Easy
2452

Words Within Two Edits of Dictionary

Identify all words in queries that can match dictionary entries with at most two character changes efficiently using arr…

Medium
2453

Destroy Sequential Targets

Find the minimum seed value to destroy the most targets on a number line, using array scanning and hash lookup.

Medium
2454

Next Greater Element IV

Find the second greater integer for each element in an array using binary search and monotonic stack techniques.

Hard
2455

Average Value of Even Numbers That Are Divisible by Three

Find the average of even numbers divisible by 3 from an array of positive integers.

Easy
2456

Most Popular Video Creator

Identify the most popular video creator by summing views and selecting their top-viewed video with array and hash patter…

Medium
2458

Height of Binary Tree After Subtree Removal Queries

Compute the height of a binary tree efficiently after removing subtrees, using traversal and precomputed node state trac…

Hard
2460

Apply Operations to an Array

Transform an array by applying adjacent doubling operations and shifting zeros efficiently using two-pointer scanning te…

Easy
2461

Maximum Sum of Distinct Subarrays With Length K

Find the maximum sum of all distinct-element subarrays of length k using array scanning and hash lookup techniques.

Medium
2462

Total Cost to Hire K Workers

Optimize the total cost of hiring exactly k workers using a two-pointer approach with invariant tracking and priority qu…

Medium
2463

Minimum Total Distance Traveled

Optimize the total distance traveled by robots to factories using dynamic programming, sorting, and state transitions.

Hard
2465

Number of Distinct Averages

Calculate the number of unique averages formed by repeatedly pairing smallest and largest elements efficiently using has…

Easy
2467

Most Profitable Path in a Tree

Solve the 'Most Profitable Path in a Tree' problem using graph traversal and depth-first search techniques to maximize A…

Medium
2470

Number of Subarrays With LCM Equal to K

Find the number of subarrays in an array where the least common multiple (LCM) of the subarray equals a given integer k.

Medium
2475

Number of Unequal Triplets in Array

Count all triplets in a positive integer array where each element is distinct using scanning and hash lookup efficiently…

Easy
2476

Closest Nodes Queries in a Binary Search Tree

Solve the problem of finding closest nodes in a Binary Search Tree for multiple queries, efficiently handling each query…

Medium
2482

Difference Between Ones and Zeros in Row and Column

This problem requires computing a difference matrix based on the ones and zeros in each row and column of a binary matri…

Medium
2488

Count Subarrays With Median K

Count the number of subarrays in a given array with median equal to a specified value k.

Hard
2491

Divide Players Into Teams of Equal Skill

Divide players into equal skill teams and return the sum of their chemistry, or -1 if impossible.

Medium
2496

Maximum Value of a String in an Array

The problem requires finding the maximum value of alphanumeric strings in an array based on length or numeric value.

Easy
2497

Maximum Star Sum of a Graph

Find the maximum star sum in a graph with specific node values and edges, using greedy algorithms to select the optimal …

Medium
2498

Frog Jump II

Frog Jump II requires finding the minimal maximum jump length for a frog to traverse stones forward and backward efficie…

Medium
2499

Minimum Total Cost to Make Arrays Unequal

Calculate the minimum cost to rearrange nums1 so that no element matches nums2 using optimal swaps and hash counting.

Hard
2500

Delete Greatest Value in Each Row

Calculate the total of removed maximum values from each row of a matrix, iterating until all columns are deleted efficie…

Easy
2501

Longest Square Streak in an Array

Find the length of the longest subsequence where each element is a perfect square of its previous one.

Medium
2502

Design Memory Allocator

Design a memory allocator that simulates allocation and deallocation of memory blocks.

Medium
2503

Maximum Number of Points From Grid Queries

Solve the Maximum Number of Points From Grid Queries problem using two-pointer scanning and invariant tracking.

Hard
2506

Count Pairs Of Similar Strings

Count similar string pairs by converting each word into a character-set signature and counting matching signatures effic…

Easy
2509

Cycle Length Queries in a Tree

Solve the problem of determining cycle lengths in a binary tree with added edges through queries.

Hard
2511

Maximum Enemy Forts That Can Be Captured

Find the maximum number of enemy forts that can be captured by moving your army using two-pointer scanning with invarian…

Easy
2512

Reward Top K Students

Calculate top K student scores by scanning reports and using hash tables for positive and negative word lookups efficien…

Medium
2515

Shortest Distance to Target String in a Circular Array

Find the shortest distance to a target string in a circular array with either left or right movement options.

Easy
2517

Maximum Tastiness of Candy Basket

Maximize the tastiness of a candy basket by choosing k candies from a list of candy prices.

Medium
2518

Number of Great Partitions

Calculate the number of great partitions of an array using state transition dynamic programming with careful sum constra…

Hard
2521

Distinct Prime Factors of Product of Array

Find the number of distinct prime factors in the product of an array of integers.

Medium
2527

Find Xor-Beauty of Array

Find the xor-beauty of an array by XORing the effective values of all possible triplets of indices.

Medium
2528

Maximize the Minimum Powered City

Determine the maximum minimum power a city can achieve by strategically adding power stations using binary search and pr…

Hard
2529

Maximum Count of Positive Integer and Negative Integer

Compute the maximum count between positive and negative integers in a sorted array using efficient binary search countin…

Easy
2530

Maximal Score After Applying K Operations

Maximize your score by applying exactly k operations on an array using greedy selection and heap optimization techniques…

Medium
2532

Time to Cross a Bridge

Time to Cross a Bridge involves simulating worker movements using arrays and heaps to determine when the last worker cro…

Hard
2535

Difference Between Element Sum and Digit Sum of an Array

Find the absolute difference between element sum and digit sum of an array of integers.

Easy
2536

Increment Submatrices by One

Increment Submatrices by One focuses on efficiently updating submatrices using row-wise prefix sums in an n by n matrix.

Medium
2537

Count the Number of Good Subarrays

Count the number of subarrays that contain at least k pairs of equal elements using array scanning and hash lookup.

Medium
2538

Difference Between Maximum and Minimum Price Sum

Compute the maximum difference between any path price sum in a tree using binary-tree traversal and state tracking effic…

Hard
2540

Minimum Common Value

Find the smallest integer appearing in both sorted arrays efficiently using array scanning and hash-based lookup techniq…

Easy
2541

Minimum Operations to Make Array Equal II

Calculate the minimum operations to make two integer arrays equal using greedy adjustments with modular checks efficient…

Medium
2542

Maximum Subsequence Score

Maximize the score of a subsequence by selecting indices based on nums1 and nums2, using a greedy approach and sorting.

Medium
2545

Sort the Students by Their Kth Score

Sort a matrix of student scores by the kth exam efficiently using array manipulation and custom sorting techniques.

Medium
2547

Minimum Cost to Split an Array

Minimize the cost of splitting an array into k subarrays by calculating importance values and applying dynamic programmi…

Hard
2549

Count Distinct Numbers on Board

Compute the number of distinct integers generated on a board using repeated modulo operations over a long sequence of da…

Easy
2551

Put Marbles in Bags

The "Put Marbles in Bags" problem challenges you to distribute marbles into bags for maximum score difference using gree…

Hard
2552

Count Increasing Quadruplets

Given a permutation of numbers, count the number of increasing quadruplets using dynamic programming.

Hard
2553

Separate the Digits in an Array

Given an array of positive integers, separate each integer into its individual digits while preserving the original orde…

Easy
2554

Maximum Number of Integers to Choose From a Range I

Determine the maximum count of integers from 1 to n avoiding banned numbers while keeping the sum under maxSum.

Medium
2555

Maximize Win From Two Segments

Maximize the total prizes by choosing two segments of length k on a sorted line of prize positions efficiently using bin…

Medium
2556

Disconnect Path in a Binary Matrix by at Most One Flip

Determine if a single cell flip can disconnect a path from the top-left to bottom-right in a binary matrix efficiently u…

Medium
2558

Take Gifts From the Richest Pile

Take Gifts From the Richest Pile uses a heap to simulate the process of taking gifts from the richest pile over a number…

Easy
2559

Count Vowel Strings in Ranges

Count the number of strings that start and end with a vowel in given ranges within an array of words.

Medium
2560

House Robber IV

House Robber IV requires calculating minimum maximum money the robber can take using state transition dynamic programmin…

Medium
2561

Rearranging Fruits

Solve the problem of rearranging fruit baskets by comparing fruit costs and minimizing swaps using array scanning and ha…

Hard
2562

Find the Array Concatenation Value

Compute the array concatenation value efficiently using two-pointer scanning while maintaining a running total of concat…

Easy
2563

Count the Number of Fair Pairs

Efficiently count all fair pairs in an array using sorting and binary search, focusing on the sum range between lower an…

Medium
2564

Substring XOR Queries

Solve the Substring XOR Queries problem using array scanning and hash lookup to efficiently handle multiple queries on b…

Medium
2567

Minimum Score by Changing Two Elements

The problem asks for the minimum score after changing two elements of an array using a greedy approach.

Medium
2568

Minimum Impossible OR

Find the smallest positive integer that cannot be formed from any subsequence OR combination in the array.

Medium
2569

Handling Sum Queries After Update

Solve the Handling Sum Queries After Update problem using arrays and segment trees with lazy propagation for efficiency.

Hard
2570

Merge Two 2D Arrays by Summing Values

Merge two 2D arrays by summing values with matching ids using array scanning and hash lookup efficiently.

Easy
2572

Count the Number of Square-Free Subsets

Learn how to efficiently count square-free subsets using state transition dynamic programming with bitmask optimizations…

Medium
2573

Find the String with LCP

Determine the lexicographically smallest string matching a given LCP matrix using state transition dynamic programming.

Hard
2574

Left and Right Sum Differences

Compute absolute differences between left and right cumulative sums for each element in an integer array efficiently.

Easy
2575

Find the Divisibility Array of a String

Calculate the divisibility array for a string by checking if prefixes are divisible by a given number.

Medium
2576

Find the Maximum Number of Marked Indices

Maximize marked indices in an array by performing allowed operations, applying binary search to find the optimal count e…

Medium
2577

Minimum Time to Visit a Cell In a Grid

Compute the fastest path in a grid where each cell has a minimum time requirement using BFS and priority queue technique…

Hard
2580

Count Ways to Group Overlapping Ranges

Count Ways to Group Overlapping Ranges is a medium difficulty problem focused on array manipulation and sorting to count…

Medium
2581

Count Number of Possible Root Nodes

Given a tree and a set of guesses, find how many nodes can be the root while satisfying the guess constraints.

Hard
2584

Split the Array to Make Coprime Products

Find the smallest index to split an array so that the products of two parts are coprime using array scanning and hash lo…

Hard
2585

Number of Ways to Earn Points

Find the number of ways to earn exactly target points using multiple types of exam questions with distinct marks.

Hard
2586

Count the Number of Vowel Strings in Range

Count the Number of Vowel Strings in Range asks to count vowel strings in a subarray of a given word list.

Easy
2587

Rearrange Array to Maximize Prefix Score

Maximize the number of positive prefix sums by rearranging an integer array using a greedy, order-focused strategy.

Medium
2588

Count the Number of Beautiful Subarrays

Count the Number of Beautiful Subarrays is a Medium-level problem involving array scanning and hash table lookup to find…

Medium
2589

Minimum Time to Complete All Tasks

Determine the minimum active time for a computer to complete all scheduled tasks within their specific time windows effi…

Hard
2592

Maximize Greatness of an Array

Maximize Greatness of an Array requires permuting numbers to exceed original values at most indices efficiently.

Medium
2593

Find Score of an Array After Marking All Elements

The problem involves marking elements in an array and calculating the score based on adjacent elements.

Medium
2594

Minimum Time to Repair Cars

Find the minimum time to repair all cars using mechanics with different ranks, applying binary search over possible time…

Medium
2596

Check Knight Tour Configuration

Validate a knight's movement configuration on an n x n chessboard to check if it forms a valid Knight's Tour.

Medium
2597

The Number of Beautiful Subsets

Count all non-empty subsets of an array where no two numbers have an absolute difference equal to k, using array scannin…

Medium
2598

Smallest Missing Non-negative Integer After Operations

Find the smallest missing non-negative integer after repeated additions or subtractions of a given value in nums array e…

Medium
2601

Prime Subtraction Operation

Determine if it's possible to make the array strictly increasing using prime subtractions.

Medium
2602

Minimum Operations to Make All Array Elements Equal

Find the minimum number of operations to make all elements in an array equal for each query.

Medium
2603

Collect Coins in a Tree

The "Collect Coins in a Tree" problem requires traversing a tree to collect coins in the fewest steps while returning to…

Hard
2605

Form Smallest Number From Two Digit Arrays

Given two arrays of digits, find the smallest possible number formed by one digit from each array.

Easy
2606

Find the Substring With Maximum Cost

Find the Substring With Maximum Cost requires calculating substring values using a hash lookup for character costs, with…

Medium
2607

Make K-Subarray Sums Equal

Solve Make K-Subarray Sums Equal by grouping circular indices with gcd cycles and minimizing each group to its median.

Medium
2610

Convert an Array Into a 2D Array With Conditions

Learn how to convert an integer array into a 2D array with distinct rows using array scanning plus hash lookup efficient…

Medium
2611

Mice and Cheese

In 'Mice and Cheese', you must maximize the total reward of two mice eating cheese while respecting their preferences an…

Medium
2612

Minimum Reverse Operations

Find the minimum number of operations to move a 1 in an array from a given start position to other positions, considerin…

Hard
2614

Prime In Diagonal

Find the largest prime number located on any diagonal of a square matrix using array iteration and prime checking techni…

Easy
2615

Sum of Distances

In this problem, you calculate an array where each element is the sum of absolute differences of indices for equal value…

Medium
2616

Minimize the Maximum Difference of Pairs

Minimize the Maximum Difference of Pairs seeks to optimize the maximum pairwise difference in a set of index pairs from …

Medium
2617

Minimum Number of Visited Cells in a Grid

Determine the minimum number of cells to visit in a grid using state transition dynamic programming and efficient traver…

Hard
2639

Find the Width of Columns of a Grid

This problem asks you to compute the width of each column in a grid, where the width is defined by the length of the lar…

Easy
2640

Find the Score of All Prefixes of an Array

Compute the score of each prefix in an array using conversion rules while tracking the maximum efficiently for prefix su…

Medium
2643

Row With Maximum Ones

Find the row with the maximum ones in a binary matrix and return its index and count.

Easy
2644

Find the Maximum Divisibility Score

Determine the divisor with the highest count of divisible elements in an array using a clear array-driven strategy.

Easy
2646

Minimize the Total Price of the Trips

Calculate the minimum total cost of multiple trips on a tree by selectively halving node prices using DFS frequency coun…

Hard
2653

Sliding Subarray Beauty

Compute the xth smallest negative number in each sliding subarray using array scanning and hash frequency tracking effic…

Medium
2654

Minimum Number of Operations to Make All Array Elements Equal to 1

Find the minimum number of operations to transform every element of a positive integer array into 1 using gcd operations…

Medium
2656

Maximum Sum With Exactly K Elements

Maximize your score by performing exactly k operations on an array using a greedy approach to select the highest values.

Easy
2657

Find the Prefix Common Array of Two Arrays

This problem challenges you to find the prefix common array of two integer permutations, utilizing array scanning and ha…

Medium
2658

Maximum Number of Fish in a Grid

Maximize the number of fish that can be caught by performing DFS on an optimal starting point in a grid.

Medium
2659

Make Array Empty

Solve the "Make Array Empty" problem using binary search to determine the minimum number of operations required.

Hard
2660

Determine the Winner of a Bowling Game

Simulate a bowling game to determine the winner based on hit pins per turn for two players.

Easy
2661

First Completely Painted Row or Column

Find the first index where a row or column is completely painted in a matrix based on an array of integers.

Medium
2662

Minimum Cost of a Path With Special Roads

Find the minimum cost path between two points, using special roads or direct moves in a 2D space.

Medium
2670

Find the Distinct Difference Array

Calculate the distinct difference array of a given list of integers by counting distinct elements in the prefix and suff…

Easy
2672

Number of Adjacent Elements With the Same Color

Calculate the number of adjacent elements sharing the same color after sequentially updating an initially zeroed array u…

Medium
2673

Make Costs of Paths Equal in a Binary Tree

Minimize the cost increments required to equalize path costs in a binary tree from root to leaves.

Medium
2678

Number of Senior Citizens

Determine how many passengers are over 60 years old based on their compressed details in an array of strings.

Easy
2679

Sum in a Matrix

Calculate the maximum score by repeatedly removing the largest elements from each row of a 2D matrix efficiently using s…

Medium
2680

Maximum OR

Maximize the bitwise OR of an array by applying at most k multiplication operations on selected elements.

Medium
2681

Power of Heroes

Calculate the total power of all non-empty hero groups using state transition dynamic programming efficiently with sorti…

Hard
2682

Find the Losers of the Circular Game

Simulate a ball-passing game around a circle using array scanning and hash lookup to find friends who never receive the …

Easy
2683

Neighboring Bitwise XOR

Determine if a binary array original exists that produces the given derived array using neighboring bitwise XOR logic.

Medium
2684

Maximum Number of Moves in a Grid

Maximize the number of moves in a grid starting from the first column using state transition dynamic programming.

Medium
2706

Buy Two Chocolates

Determine the leftover money after buying exactly two chocolates using a greedy selection and sum validation approach.

Easy
2707

Extra Characters in a String

The problem asks for the minimum number of extra characters left after optimally breaking a string into substrings found…

Medium
2708

Maximum Strength of a Group

Maximize the strength of a student group by carefully selecting students based on their scores, using dynamic programmin…

Medium
2709

Greatest Common Divisor Traversal

Determine if every index in an array can be reached from any other using traversals based on greatest common divisors.

Hard
2711

Difference of Number of Distinct Values on Diagonals

Find the difference in the number of distinct diagonal values in a matrix, returning results in a new matrix.

Medium
2713

Maximum Strictly Increasing Cells in a Matrix

Find the maximum number of cells that can be visited in a matrix by following strictly increasing values from a starting…

Hard
2717

Semi-Ordered Permutation

Find the minimum number of operations to convert a permutation into a semi-ordered permutation where 1 is first and n is…

Easy
2718

Sum of Matrix After Queries

Calculate the total sum of a zero-filled n x n matrix after sequentially applying row and column update queries efficien…

Medium
2731

Movement of Robots

Calculate total distances between robots moving on a number line while accounting for collisions using array plus braint…

Medium
2732

Find a Good Subset of the Matrix

Find a Good Subset of the Matrix is a challenging problem involving array scanning, hash lookup, and bit manipulation to…

Hard
2733

Neither Minimum nor Maximum

Find a number in an array that is neither the minimum nor maximum value, or return -1 if no such number exists.

Easy
2735

Collecting Chocolates

Calculate the minimum cost to collect all chocolate types using rotations and purchases in an array-based enumeration pa…

Medium
2736

Maximum Sum Queries

Find the maximum sum of paired elements from two arrays under query constraints using efficient binary search techniques…

Hard
2740

Find the Value of the Partition

Find the minimum partition value by dividing a positive integer array into two subarrays using sorting for efficiency.

Medium
2741

Special Permutations

Count the number of special permutations for a given array using dynamic programming and bit manipulation.

Medium
2742

Painting the Walls

Compute the minimum cost to paint all walls using a paid and free painter with state transition dynamic programming.

Hard
2744

Find Maximum Number of String Pairs

Find the maximum number of pairs of distinct strings from an array where one string is the reverse of the other.

Easy
2746

Decremental String Concatenation

Solve the Decremental String Concatenation problem by applying dynamic programming to minimize string length after conca…

Medium
2747

Count Zero Request Servers

Count Zero Request Servers finds the number of servers with zero requests during specific time intervals for a given set…

Medium
2748

Number of Beautiful Pairs

Count all index pairs in an array where the first digit of one number and last digit of another are coprime efficiently.

Easy
2750

Ways to Split Array Into Good Subarrays

Calculate the number of ways to partition a binary array into good subarrays using state transition dynamic programming …

Medium
2751

Robot Collisions

Robot Collisions involves simulating robot movements and handling collisions with stack-based state management.

Hard
2760

Longest Even Odd Subarray With Threshold

Determine the length of the longest subarray where elements alternate even and odd while staying below a given threshold…

Easy
2761

Prime Pairs With Target Sum

Find all prime number pairs that sum up to a given integer n using an efficient sieve-based array approach.

Medium
2762

Continuous Subarrays

Count all continuous subarrays efficiently using sliding window with running max-min state tracking for array consistenc…

Medium
2763

Sum of Imbalance Numbers of All Subarrays

Learn how to compute the total imbalance across all subarrays by updating gap counts as each subarray expands.

Hard
2765

Longest Alternating Subarray

Find the longest alternating subarray in a given array of integers.

Easy
2766

Relocate Marbles

Relocate marbles to new positions in an array by simulating moves, and return sorted occupied positions.

Medium
2768

Number of Black Blocks

Calculate the number of black blocks in a grid given a list of black cell coordinates.

Medium
2770

Maximum Number of Jumps to Reach the Last Index

Find the maximum number of jumps to reach the last index using state transition dynamic programming efficiently in array…

Medium
2771

Longest Non-decreasing Subarray From Two Arrays

Maximize the length of a non-decreasing subarray by optimally choosing elements from two arrays using dynamic programmin…

Medium
2772

Apply Operations to Make All Array Elements Equal to Zero

Determine if all elements in a given array can be reduced to zero using repeated k-length prefix operations efficiently.

Medium
2778

Sum of Squares of Special Elements

Calculate the sum of squares of special elements in a 1-indexed array using index divisibility checks efficiently.

Easy
2779

Maximum Beauty of an Array After Applying Operation

Find the maximum beauty of an array by adjusting elements within a range using binary search and sliding window techniqu…

Medium
2780

Minimum Index of a Valid Split

Find the minimum index to split an array such that both subarrays have the same dominant element.

Medium
2781

Length of the Longest Valid Substring

This problem asks for the longest valid substring of a word that doesn't contain any substrings from a forbidden list.

Hard
2784

Check if Array is Good

Determine if a given integer array is a permutation of base[n], containing 1 to n-1 once and n twice, using scanning and…

Easy
2786

Visit Array Positions to Maximize Score

Maximize your score by visiting positions in an array while handling penalties for parity changes efficiently with DP.

Medium
2788

Split Strings by Separator

Split Strings by Separator requires iterating through an array of strings and splitting each by a given separator charac…

Easy
2789

Largest Element in an Array after Merge Operations

This problem focuses on applying greedy choices and merging elements to find the largest element in an array.

Medium
2790

Maximum Number of Groups With Increasing Length

Maximize the number of groups that can be formed with given usage limits, leveraging binary search for optimal solutions…

Hard
2798

Number of Employees Who Met the Target

Determine how many employees reach the required work hours using a direct array-driven counting approach.

Easy
2799

Count Complete Subarrays in an Array

Count Complete Subarrays in an Array requires scanning the array while tracking elements to detect subarrays with all di…

Medium
2808

Minimum Seconds to Equalize a Circular Array

Find the minimum number of seconds to equalize a circular array using array scanning and hash lookup techniques.

Medium
2809

Minimum Time to Make Array Sum At Most x

Calculate the minimum seconds to reduce the array sum to at most x using optimal single-time reductions per index effici…

Hard
2811

Check if it is Possible to Split Array

Determine whether an array can be fully split into single-element subarrays using a state transition dynamic programming…

Medium
2812

Find the Safest Path in a Grid

Find the Safest Path in a Grid uses binary search and BFS to maximize path safeness from thieves in a grid.

Medium
2813

Maximum Elegance of a K-Length Subsequence

Maximize elegance of a k-length subsequence from a list of items with profits and categories.

Hard
2815

Max Pair Sum in an Array

Find the maximum sum of two numbers in an array sharing the same largest digit using a hash-based scan efficiently.

Easy
2817

Minimum Absolute Difference Between Elements With Constraint

Find the minimum absolute difference between two array elements that are at least x indices apart using binary search.

Medium
2818

Apply Operations to Maximize Score

Maximize the score by applying operations on a subarray at most k times, utilizing stack-based state management.

Hard
2824

Count Pairs Whose Sum is Less than Target

This problem asks you to count all index pairs in an array whose sum is strictly less than a given target value efficien…

Easy
2826

Sorting Three Groups

Determine the minimum removals to make an array of 1s, 2s, and 3s non-decreasing using dynamic programming transitions.

Medium
2828

Check if a String Is an Acronym of Words

Check if a string can be formed by concatenating the first letters of each word in a given list.

Easy
2830

Maximize the Profit as the Salesman

Determine the maximum profit a salesman can earn by strategically selecting non-overlapping offers on consecutive houses…

Medium
2831

Find the Longest Equal Subarray

Find the maximum length of an equal subarray after removing up to k elements using array scanning and hash-based index t…

Medium
2835

Minimum Operations to Form Subsequence With Target Sum

The problem requires finding the minimum number of operations to form a subsequence summing to a target using powers of …

Hard
2836

Maximize Value of Function in a Ball Passing Game

Maximize the total score in a ball-passing game by selecting the best starting player using state transition dynamic pro…

Hard
2841

Maximum Sum of Almost Unique Subarray

Find the maximum sum of subarrays that contain at least m distinct elements using array scanning and hash lookups effici…

Medium
2845

Count of Interesting Subarrays

Count all subarrays where the number of elements satisfying a modulo condition equals a target k using efficient prefix …

Medium
2846

Minimum Edge Weight Equilibrium Queries in a Tree

Find the minimum number of operations to equalize edge weights in a tree between given pairs of nodes.

Hard
2848

Points That Intersect With Cars

Count covered integer points by merging overlapping car intervals or marking visited positions on the number line.

Easy
2850

Minimum Moves to Spread Stones Over Grid

Solve the problem of distributing 9 stones across a 3x3 grid with minimal moves using state transition dynamic programmi…

Medium
2855

Minimum Right Shifts to Sort the Array

Determine the minimum number of right shifts to sort a distinct integer array or return -1 if impossible using array ana…

Easy
2856

Minimum Array Length After Pair Removals

This problem involves minimizing the length of a sorted array by repeatedly removing adjacent pairs of equal elements.

Medium
2857

Count Pairs of Points With Distance k

Solve the problem of counting pairs of points with distance k using array scanning and hash table techniques.

Medium
2859

Sum of Values at Indices With K Set Bits

Sum values in an array where the indices have exactly k set bits in binary representation.

Easy
2860

Happy Students

The Happy Students problem asks how many ways a teacher can select a group of students so everyone is happy, based on ce…

Medium
2861

Maximum Number of Alloys

Determine the maximum number of alloys possible using limited metal stock and budget, leveraging binary search efficient…

Medium
2862

Maximum Element-Sum of a Complete Subset of Indices

Given a 1-indexed array, select a subset where indices' product is a perfect square, then return the maximum sum.

Hard
2865

Beautiful Towers I

Solve Beautiful Towers I by testing each peak and enforcing mountain limits with monotonic stack style height propagatio…

Medium
2866

Beautiful Towers II

Maximize tower configurations with the stack-based approach while ensuring mountain-like patterns in this medium difficu…

Medium
2869

Minimum Operations to Collect Elements

Scan from the end, track seen values from 1 to k, and stop once every required number is collected.

Easy
2870

Minimum Number of Operations to Make Array Empty

Minimize the number of operations to make an array empty by leveraging array scanning and hash lookup.

Medium
2871

Split Array Into Maximum Number of Subarrays

Maximize the number of subarrays in an array while ensuring each subarray's bitwise AND meets the minimum score requirem…

Medium
2873

Maximum Value of an Ordered Triplet I

Find the maximum value of a triplet in an array where indices follow the order i < j < k.

Easy
2874

Maximum Value of an Ordered Triplet II

Solve Maximum Value of an Ordered Triplet II in linear time by tracking the best left difference and right multiplier.

Medium
2875

Minimum Size Subarray in Infinite Array

Find the shortest subarray in an infinite array that sums to a given target using array scanning and hash lookup.

Medium
2895

Minimum Processing Time

Determine the minimum total processing time by optimally assigning tasks to multiple processors using a greedy approach.

Medium
2897

Apply Operations on Array to Maximize Sum of Squares

Maximizing the sum of squares in an array through bitwise operations on selected elements.

Hard
2899

Last Visited Integers

This problem involves finding the last visited integer for each -1 in a given array by simulating a stack-like behavior.

Easy
2900

Longest Unequal Adjacent Groups Subsequence I

Find the longest alternating subsequence in a string array based on a binary group array.

Easy
2901

Longest Unequal Adjacent Groups Subsequence II

Find the longest subsequence of indices such that the corresponding strings have a valid Hamming distance and group cons…

Medium
2902

Count of Sub-Multisets With Bounded Sum

This problem asks you to count the number of sub-multisets within a given array that have a sum in a specified range.

Hard
2903

Find Indices With Index and Value Difference I

Find two indices in an array where their difference in both index and value meets specified thresholds.

Easy
2905

Find Indices With Index and Value Difference II

Locate two indices in an array where both index and value differences meet specified thresholds using precise scanning t…

Medium
2906

Construct Product Matrix

Solve the "Construct Product Matrix" problem by calculating the product of elements in 2D matrices without division.

Medium
2908

Minimum Sum of Mountain Triplets I

Find the minimum sum of a mountain triplet in an array of integers, or return -1 if no valid triplet exists.

Easy
2909

Minimum Sum of Mountain Triplets II

Find the minimum sum of a valid mountain triplet in an integer array, or return -1 if no valid triplet exists.

Medium
2910

Minimum Number of Groups to Create a Valid Assignment

The problem involves sorting balls into boxes while minimizing the number of boxes, adhering to size constraints.

Medium
2913

Subarrays Distinct Element Sum of Squares I

Compute the sum of squares of distinct elements for all subarrays using array scanning with hash lookups efficiently.

Easy
2915

Length of the Longest Subsequence That Sums to Target

Find the length of the longest subsequence in an array that sums to a target value, using dynamic programming.

Medium
2916

Subarrays Distinct Element Sum of Squares II

Compute the sum of squares of distinct elements in all subarrays using state transition dynamic programming efficiently.

Hard
2917

Find the K-or of an Array

Given an integer array nums and an integer k, find the K-or of nums where bits qualify based on the occurrence of 1s.

Easy
2918

Minimum Equal Sum of Two Arrays After Replacing Zeros

Find the minimum sum where two arrays become equal after replacing all zeros with positive integers using a greedy strat…

Medium
2919

Minimum Increment Operations to Make Array Beautiful

Optimize the number of increment operations to make an array beautiful by ensuring subarrays of size 3 or more meet the …

Medium
2920

Maximum Points After Collecting Coins From All Nodes

Find the maximum points after collecting coins from all nodes of a tree using binary-tree traversal and state tracking.

Hard
2923

Find Champion I

Find Champion I is an easy problem focusing on identifying the strongest team in a tournament using matrix-based compari…

Easy
2926

Maximum Balanced Subsequence Sum

Learn to find the maximum sum of a balanced subsequence using dynamic programming and careful state transitions efficien…

Hard
2931

Maximum Spending After Buying Items

Maximize spending by carefully choosing the right items across multiple shops over m * n days.

Hard
2932

Maximum Strong Pair XOR I

Find the maximum XOR of any strong pair in an integer array using array scanning and hash-based lookups efficiently.

Easy
2933

High-Access Employees

Identify employees with high system access within one-hour periods based on access logs.

Medium
2934

Minimum Operations to Maximize Last Elements in Arrays

Minimize the number of operations needed to maximize the last elements of two arrays with specific swaps.

Medium
2935

Maximum Strong Pair XOR II

Find the maximum XOR among strong pairs in an array using array scanning and hash-based lookups efficiently.

Hard
2940

Find Building Where Alice and Bob Can Meet

Determine the leftmost building where Alice and Bob can meet using a binary search over valid move sequences.

Hard
2942

Find Words Containing Character

Identify all indices of words containing a specific character using array and string traversal techniques efficiently.

Easy
2943

Maximize Area of Square Hole in Grid

Learn how to maximize the area of a square-shaped hole by selectively removing horizontal and vertical bars efficiently …

Medium
2944

Minimum Number of Coins for Fruits

Calculate the minimum coins to buy fruits using state transition dynamic programming while handling rewards and purchase…

Medium
2945

Find Maximum Non-decreasing Array Length

Solve Find Maximum Non-decreasing Array Length with prefix-sum DP transitions that maximize kept segments while preservi…

Hard
2946

Matrix Similarity After Cyclic Shifts

Determine if a matrix returns to its original state after performing cyclic row shifts k times using array and math patt…

Easy
2948

Make Lexicographically Smallest Array by Swapping Elements

Solve the problem of making an array lexicographically smallest through element swaps under a limit constraint.

Medium
2951

Find the Peaks

Identify all peaks in a mountain array using direct array enumeration and strict neighbor comparisons efficiently.

Easy
2952

Minimum Number of Coins to be Added

Determine the minimum number of coins to add so all values up to target are obtainable using a greedy sum approach.

Medium
2954

Count the Number of Infection Sequences

Calculate all valid infection sequences in a line by using array positions and combinatorial math efficiently for n peop…

Hard
2956

Find Common Elements Between Two Arrays

Quickly find all numbers that appear in both arrays using scanning and hash lookup to handle duplicates efficiently.

Easy
2958

Length of Longest Subarray With at Most K Frequency

Find the maximum length subarray where each number appears at most k times using array scanning and hash lookups.

Medium
2960

Count Tested Devices After Test Operations

Simulate testing devices based on battery percentages to determine how many pass the test operations in sequence.

Easy
2961

Double Modular Exponentiation

Solve the Double Modular Exponentiation problem by applying array manipulation and modular arithmetic to find good indic…

Medium
2962

Count Subarrays Where Max Element Appears at Least K Times

Find the number of subarrays where the maximum element appears at least k times using a sliding window approach.

Medium
2963

Count the Number of Good Partitions

Calculate how many ways to partition an array into contiguous subarrays where no number repeats across segments using ha…

Hard
2965

Find Missing and Repeated Values

Find the missing and repeated numbers in an n x n grid using array scanning and hash lookup.

Easy
2966

Divide Array Into Arrays With Max Difference

Divide an array into subarrays with a maximum element difference under a given threshold using a greedy approach.

Medium
2967

Minimum Cost to Make Array Equalindromic

Determine the minimum cost to convert an integer array into a palindromic array using allowed element modifications effi…

Medium
2968

Apply Operations to Maximize Frequency Score

Maximize the frequency score by applying up to k operations on a sorted array using binary search over valid answer spac…

Hard
2970

Count the Number of Incremovable Subarrays I

Count the number of incremovable subarrays in an array by removing them to create a strictly increasing sequence.

Easy
2971

Find Polygon With the Largest Perimeter

Determine the largest perimeter polygon from a set of side lengths using a greedy approach with invariant validation che…

Medium
2972

Count the Number of Incremovable Subarrays II

Count the number of incremovable subarrays where removal of the subarray results in a strictly increasing array.

Hard
2974

Minimum Number Game

The Minimum Number Game involves simulating moves by Alice and Bob on an array, sorting elements and appending them to a…

Easy
2975

Maximum Square Area by Removing Fences From a Field

This problem challenges you to calculate the largest square area possible by removing fences from a given rectangular fi…

Medium
2976

Minimum Cost to Convert String I

This problem asks to calculate the minimum cost to convert a string from source to target using specific character trans…

Medium
2977

Minimum Cost to Convert String II

Compute the minimum cost to transform source into target using substring replacements with given costs efficiently using…

Hard
2980

Check if Bitwise OR Has Trailing Zeros

Check if a bitwise OR of two or more numbers has trailing zeros in its binary representation.

Easy
2996

Smallest Missing Integer Greater Than Sequential Prefix Sum

Find the smallest missing integer greater than the sum of the longest sequential prefix in an array.

Easy
2997

Minimum Number of Operations to Make Array XOR Equal to K

Find the minimum number of operations to make the XOR of an array equal to a given value k by modifying array elements.

Medium
3000

Maximum Area of Longest Diagonal Rectangle

Find the rectangle with the longest diagonal in a 2D array and return its area, prioritizing maximum area on ties.

Easy
3002

Maximum Size of a Set After Removals

Maximize a set size by strategically removing half of elements from two arrays using hash lookups and array scanning.

Medium
3005

Count Elements With Maximum Frequency

Count Elements With Maximum Frequency is solved by counting each value, tracking the highest count, and summing matching…

Easy
3010

Divide an Array Into Subarrays With Minimum Cost I

Divide an array into three contiguous subarrays with minimum cost by leveraging array and sorting principles.

Easy
3011

Find if Array Can Be Sorted

Determine if a given array can be sorted using adjacent swaps restricted by equal set bits in binary representation.

Medium
3012

Minimize Length of Array Using Operations

Minimize the length of an integer array through a series of operations, using a greedy approach with modular arithmetic.

Medium
3013

Divide an Array Into Subarrays With Minimum Cost II

This problem asks to divide an array into subarrays with a minimal cost and certain constraints on subarray positions.

Hard
3020

Find the Maximum Number of Elements in Subset

This problem asks you to find the maximum subset size where each number in the subset follows a specific pattern with ha…

Medium
3022

Minimize OR of Remaining Elements Using Operations

Minimize the bitwise OR of the remaining elements of an array after applying at most k operations.

Hard
3024

Type of Triangle

Determine the type of triangle from a three-element array using side sums and equality checks efficiently in constant ti…

Easy
3025

Find the Number of Ways to Place People I

Calculate how many valid pairs of points can be formed on a 2D plane using array and math enumeration techniques efficie…

Medium
3026

Maximum Good Subarray Sum

Find the maximum sum of any subarray where the first and last elements differ by exactly k using efficient array scannin…

Medium
3027

Find the Number of Ways to Place People II

Calculate all valid placements of people on a 2D grid ensuring Alice can fence herself with Bob without enclosing others…

Hard
3028

Ant on the Boundary

Solve the problem of counting how often an ant returns to a boundary based on the steps described in the input array.

Easy
3030

Find the Grid of Region Average

Find the Grid of Region Average requires identifying regions in a matrix where pixel differences are below a threshold, …

Medium
3033

Modify the Matrix

Modify the Matrix efficiently by replacing all -1 elements with the maximum in their column using array and matrix opera…

Easy
3034

Number of Subarrays That Match a Pattern I

Count all subarrays in a given integer array that strictly follow a defined numeric pattern using rolling hash checks ef…

Medium
3035

Maximum Palindromes After Operations

The problem focuses on maximizing the number of palindromes that can be formed from a given list of words through specif…

Medium
3036

Number of Subarrays That Match a Pattern II

Count subarrays matching a pattern of relative values using array transformation and rolling hash techniques.

Hard
3038

Maximum Number of Operations With the Same Score I

Determine the maximum number of operations in an integer array where each operation must produce the same score.

Easy
3039

Apply Operations to Make String Empty

Learn how to systematically apply operations on a string using array scanning and hash lookups to reduce it efficiently.

Medium
3040

Maximum Number of Operations With the Same Score II

This problem asks to maximize operations on an integer array where all deletions produce the same score using dynamic pr…

Medium
3041

Maximize Consecutive Elements in an Array After Modification

Solve Maximize Consecutive Elements in an Array After Modification by sorting and using state transition DP on value and…

Hard
3042

Count Prefix and Suffix Pairs I

Count all index pairs where one word is both a prefix and suffix of another, using efficient array and string checks.

Easy
3043

Find the Length of the Longest Common Prefix

Determine the length of the longest common prefix between two integer arrays using array scanning and hash lookup effici…

Medium
3044

Most Frequent Prime

Find the most frequent prime over 10 from numbers generated by scanning a 2D matrix in all straight directions efficient…

Medium
3045

Count Prefix and Suffix Pairs II

Count the number of index pairs in a string array where one word is both a prefix and suffix of another using array and …

Hard
3046

Split the Array

Determine if an even-length array can be split into two parts with all distinct elements using hash lookup scanning.

Easy
3047

Find the Largest Area of Square Inside Two Rectangles

Find the largest square area that can fit inside the intersection of two or more rectangles in a 2D plane.

Medium
3048

Earliest Second to Mark Indices I

The problem asks to determine the earliest second to mark all indices in an array using a set of operations.

Medium
3049

Earliest Second to Mark Indices II

This problem asks to determine the earliest second at which all indices in an array can be marked using a sequence of op…

Hard
3065

Minimum Operations to Exceed Threshold Value I

Count how many numbers are below k, because each such value must be removed in Minimum Operations to Exceed Threshold Va…

Easy
3066

Minimum Operations to Exceed Threshold Value II

Calculate the fewest operations to make every array element exceed a threshold using a min-heap simulation strategy effi…

Medium
3067

Count Pairs of Connectable Servers in a Weighted Tree Network

This problem involves counting pairs of connectable servers in a weighted tree network using binary-tree traversal and D…

Medium
3068

Find the Maximum Sum of Node Values

Solve Find the Maximum Sum of Node Values by tracking XOR gain parity, not by simulating edge operations across the tree…

Hard
3069

Distribute Elements Into Two Arrays I

Distribute elements from a distinct integer array into two subarrays using a sequential simulation strategy for optimal …

Easy
3070

Count Submatrices with Top-Left Element and Sum Less Than k

Count all submatrices including the top-left element with sum less than k using array and matrix prefix sum strategies.

Medium
3071

Minimum Operations to Write the Letter Y on a Grid

Find the minimum number of operations to write the letter Y on a grid by altering cell values.

Medium
3072

Distribute Elements Into Two Arrays II

Distribute elements into two arrays based on conditions, utilizing a Binary Indexed Tree for efficient counting and simu…

Hard
3074

Apple Redistribution into Boxes

Distribute packs of apples into boxes using a greedy strategy, minimizing the number of boxes selected efficiently and c…

Easy
3075

Maximize Happiness of Selected Children

Maximize the happiness of selected children by choosing the k happiest ones and applying greedy strategies to minimize l…

Medium
3076

Shortest Uncommon Substring in an Array

Find the shortest substring for each string in an array that does not appear in any other string efficiently using hashi…

Medium
3077

Maximum Strength of K Disjoint Subarrays

Solve Maximum Strength of K Disjoint Subarrays with dynamic programming that tracks segment state, sign changes, and wei…

Hard
3079

Find the Sum of Encrypted Integers

Compute the sum of encrypted integers by replacing each digit with the largest digit, combining array traversal with dig…

Easy
3080

Mark Elements on Array by Performing Queries

Efficiently mark elements in an array based on queries using scanning plus hash lookup to track marked indices and compu…

Medium
3082

Find the Sum of the Power of All Subsequences

Find the sum of the power of all subsequences of an integer array where their sum equals a given number.

Hard
3086

Minimum Moves to Pick K Ones

Find the minimum number of moves to pick exactly k ones from a binary array, considering a constraint on changes.

Hard
3092

Most Frequent IDs

Track the most frequent ID after each update in a dynamic collection of IDs with changing frequencies.

Medium
3093

Longest Common Suffix Queries

Find the index of the string in wordsContainer with the longest common suffix for each query efficiently using array and…

Hard
3095

Shortest Subarray With OR at Least K I

Find the shortest non-empty subarray in nums whose bitwise OR reaches at least k using sliding window efficiently.

Easy
3096

Minimum Levels to Gain More Points

Determine the minimum number of levels Alice must play in a binary game array to secure more points than Bob using prefi…

Medium
3097

Shortest Subarray With OR at Least K II

Find the length of the shortest subarray where the bitwise OR of all its elements is at least a given value.

Medium
3098

Find the Sum of Subsequence Powers

Compute the sum of powers for all subsequences of length k using state transition dynamic programming efficiently.

Hard
3101

Count Alternating Subarrays

Count all alternating subarrays in a binary array efficiently using array patterns and simple mathematical reasoning.

Medium
3102

Minimize Manhattan Distances

Compute the minimum maximum Manhattan distance by removing one point using array math and geometry insights efficiently.

Hard
3105

Longest Strictly Increasing or Strictly Decreasing Subarray

Find the longest subarray in a given array that is either strictly increasing or strictly decreasing.

Easy
3107

Minimum Operations to Make Median of Array Equal to K

The problem involves minimizing operations to make the median of an array equal to a given value k using a greedy approa…

Medium
3108

Minimum Cost Walk in Weighted Graph

Find the minimum cost walk in a weighted graph using array and bit manipulation techniques for efficient path calculatio…

Hard
3111

Minimum Rectangles to Cover Points

Find the minimum number of rectangles needed to cover all points, given constraints on width and position.

Medium
3112

Minimum Time to Visit Disappearing Nodes

Determine the minimum time to visit each node in a disappearing-node graph using arrays, graphs, and priority queues eff…

Medium
3113

Find the Number of Subarrays Where Boundary Elements Are Maximum

Count the subarrays where the first and last elements are the largest in the subarray, utilizing binary search over vali…

Hard
3115

Maximum Prime Difference

Calculate the largest index gap between prime numbers in an array using array traversal and number theory insights effic…

Medium
3116

Kth Smallest Amount With Single Denomination Combination

Find the kth smallest amount using only one coin denomination at a time, applying binary search efficiently over possibl…

Hard
3117

Minimum Sum of Values by Dividing Array

Solve the problem of dividing an array into subarrays to match specified bitwise AND values using dynamic programming.

Hard
3122

Minimum Number of Operations to Satisfy Conditions

This problem asks to find the minimum number of operations on a 2D grid using state transition dynamic programming effic…

Medium
3127

Make a Square with the Same Color

Determine if a 3x3 grid can form a 2x2 square of the same color by changing at most one cell efficiently.

Easy
3128

Right Triangles

Count all possible right triangles in a 2D boolean grid using array scanning and hash lookup for efficiency.

Medium
3131

Find the Integer Added to Array I

Find the integer added to nums1 to make it equal to nums2 using an array-driven strategy.

Easy
3132

Find the Integer Added to Array II

Given two arrays nums1 and nums2, determine the integer added to nums1 to make it equal to nums2 after removing two elem…

Medium
3134

Find the Median of the Uniqueness Array

Given a nums array, find the median of its uniqueness array by considering all subarrays and their distinct element coun…

Hard
3139

Minimum Cost to Equalize Array

Compute the minimum cost to make all elements equal using selective operations guided by greedy choices and invariant ch…

Hard
3142

Check if Grid Satisfies Conditions

Check if a grid satisfies given conditions by analyzing array and matrix structure with specific checks on values.

Easy
3143

Maximum Points Inside the Square

Find the maximum number of points inside a valid square centered at the origin using a scanning and hashing approach.

Medium
3145

Find Products of Elements of Big Array

Solve queries on a massive array of powers of two using binary search to efficiently compute modular products of subarra…

Hard
3147

Taking Maximum Energy From the Mystic Dungeon

Maximize your energy by strategically jumping through magicians using array and prefix sum techniques for optimal path c…

Medium
3148

Maximum Difference Score in a Grid

Maximize the score in a grid by making moves to the bottom or right, using state transition dynamic programming.

Medium
3149

Find the Minimum Cost Array Permutation

Determine the lexicographically smallest permutation of nums that minimizes a cyclic score using state transition DP tec…

Hard
3151

Special Array I

Determine if an array is special by checking alternating parity for every adjacent pair in linear time.

Easy
3152

Special Array II

Determine whether each subarray meets the special condition of alternating parity for all adjacent elements efficiently …

Medium
3153

Sum of Digit Differences of All Pairs

Sum of Digit Differences of All Pairs is a problem that involves counting digit differences in pairs from an array of in…

Medium
3158

Find the XOR of Numbers Which Appear Twice

Find the XOR of numbers appearing twice by scanning the array and using a hash table for efficient tracking and combinat…

Easy
3159

Find Occurrences of an Element in an Array

Determine the position of each requested occurrence of x in nums using a hash table and efficient array scanning.

Medium
3160

Find the Number of Distinct Colors Among the Balls

Efficiently track colors on balls using array scanning and hash lookup to return the count of distinct colors after each…

Medium
3161

Block Placement Queries

Determine if blocks can be placed on an infinite number line using queries, leveraging binary search over the valid answ…

Hard
3162

Find the Number of Good Pairs I

Count all good pairs where an element in nums1 is divisible by a scaled element in nums2 using efficient array scanning.

Easy
3164

Find the Number of Good Pairs II

Calculate total good pairs by scanning two arrays and using hash lookup to match divisible elements efficiently with k.

Medium
3165

Maximum Sum of Subsequence With Non-adjacent Elements

Compute the maximum sum of a subsequence where no two adjacent elements are selected after each array update efficiently…

Hard
3169

Count Days Without Meetings

Count Days Without Meetings is a problem where you need to count days without scheduled meetings in a given work period.

Medium
3171

Find Subarray With Bitwise OR Closest to K

Find a subarray with bitwise OR closest to a given value k with minimal absolute difference.

Hard
3175

Find The First Player to win K Games in a Row

Determine which player first wins k consecutive games using array simulation logic to track ongoing victories efficientl…

Medium
3176

Find the Maximum Length of a Good Subsequence I

Find the maximum length of a good subsequence by scanning arrays and using hash lookups for value remapping efficiently.

Medium
3177

Find the Maximum Length of a Good Subsequence II

Determine the maximum length of a good subsequence in an integer array using array scanning and hash lookup efficiently.

Hard
3179

Find the N-th Value After K Seconds

Solve for the N-th value after K seconds by simulating array updates and using prefix sum techniques.

Medium
3180

Maximum Total Reward Using Operations I

Optimize the total reward by choosing operations on array indices using state transition dynamic programming techniques …

Medium
3181

Maximum Total Reward Using Operations II

Maximize your total reward using dynamic programming with state transitions in this challenging problem involving array …

Hard
3184

Count Pairs That Form a Complete Day I

Count all pairs in an array where their sum forms a complete day using hash-based counting for efficiency.

Easy
3185

Count Pairs That Form a Complete Day II

Count the number of valid pairs of hours that form a complete day by checking if their sum is a multiple of 24.

Medium
3186

Maximum Total Damage With Spell Casting

Calculate the maximum total damage by selectively casting spells while avoiding adjacent power conflicts using array sca…

Medium
3187

Peaks in Array

Determine peaks in a dynamic integer array using efficient Binary Indexed Tree updates and range queries for fast result…

Hard
3190

Find Minimum Operations to Make All Elements Divisible by Three

Find the minimum number of operations to make all elements in an array divisible by three.

Easy
3191

Minimum Operations to Make Binary Array Elements Equal to One I

Find the minimum number of operations to make all elements of a binary array equal to one using sliding window and state…

Medium
3192

Minimum Operations to Make Binary Array Elements Equal to One II

Solve the Minimum Operations to Make Binary Array Elements Equal to One II using state transition dynamic programming ef…

Medium
3193

Count the Number of Inversions

Count the number of valid permutations satisfying inversion constraints using state transition dynamic programming.

Hard
3194

Minimum Average of Smallest and Largest Elements

Solve the Minimum Average of Smallest and Largest Elements problem using two-pointer scanning to track averages effectiv…

Easy
3195

Find the Minimum Area to Cover All Ones I

Find the smallest rectangle to cover all 1's in a 2D binary matrix, focusing on array and matrix handling.

Medium
3196

Maximize Total Cost of Alternating Subarrays

Maximize the total cost of alternating subarrays using dynamic programming to efficiently split an array into optimal su…

Medium
3197

Find the Minimum Area to Cover All Ones II

Find the minimum area to cover all 1's in a 2D binary grid using three non-overlapping rectangles.

Hard
3200

Maximum Height of a Triangle

Find the maximum height of a triangle that can be formed using red and blue balls under given constraints.

Easy
3201

Find the Maximum Length of Valid Subsequence I

Find the longest valid subsequence in an array of integers using dynamic programming to handle different patterns of seq…

Medium
3202

Find the Maximum Length of Valid Subsequence II

Determine the maximum length of a valid subsequence using state transition dynamic programming with careful modulo const…

Medium
3206

Alternating Groups I

Count all alternating groups in a circular array by tracking tiles with distinct neighbors efficiently using sliding win…

Easy
3207

Maximum Points After Enemy Battles

Solve the "Maximum Points After Enemy Battles" problem by maximizing points through greedy choices with energy validatio…

Medium
3208

Alternating Groups II

Solve the problem of counting alternating groups in a circle of tiles using a sliding window approach.

Medium
3209

Number of Subarrays With AND Value of K

The problem asks to find the number of subarrays with a given AND value in an array, utilizing binary search for optimiz…

Hard
3212

Count Submatrices With Equal Frequency of X and Y

Count the number of submatrices with equal frequency of 'X' and 'Y' in a 2D character grid.

Medium
3213

Construct String with Minimum Cost

This problem asks you to construct a target string using given words at minimal cost using dynamic programming technique…

Hard
3217

Delete Nodes From Linked List Present in Array

Remove nodes from a linked list if their values exist in a given array.

Medium
3218

Minimum Cost for Cutting Cake I

In this problem, you need to minimize the cost of cutting a cake into 1x1 pieces using vertical and horizontal cuts.

Medium
3219

Minimum Cost for Cutting Cake II

Solve Minimum Cost for Cutting Cake II by choosing optimal cuts using a greedy strategy while tracking cost increments p…

Hard
3224

Minimum Array Changes to Make Differences Equal

Minimize changes to make array differences equal by replacing elements within a given range.

Medium
3225

Maximum Score From Grid Operations

Maximize your score by choosing the optimal sequence of column operations on a grid using dynamic programming transition…

Hard
3229

Minimum Operations to Make Array Equal to Target

This problem requires calculating the minimum number of operations to transform one array into another using state trans…

Hard
3232

Find if Digit Game Can Be Won

Determine if Alice can guarantee a win in a game by selectively summing single or double-digit numbers from an array.

Easy
3233

Find the Count of Numbers Which Are Not Special

Count the numbers between two integers that are not special, where special numbers are squares of primes.

Medium
3235

Check if the Rectangle Corner Is Reachable

Determine if there is a valid path from the bottom-left to top-right of a rectangle while avoiding circles.

Hard
3238

Find the Number of Winning Players

Find how many players in a game win by picking more balls of a single color than their index position.

Easy
3239

Minimum Number of Flips to Make Binary Grid Palindromic I

Find the minimum flips to make a binary grid palindromic by scanning with two pointers and tracking symmetry efficiently…

Medium
3240

Minimum Number of Flips to Make Binary Grid Palindromic II

The problem asks to flip cells in a binary grid to make its rows and columns palindromic using the minimum number of fli…

Medium
3242

Design Neighbor Sum Service

Design a service that computes sums for adjacent and diagonal elements in a 2D grid.

Easy
3243

Shortest Distance After Road Addition Queries I

Solve shortest paths dynamically in a growing graph using BFS, updating distances efficiently after each road addition q…

Medium
3244

Shortest Distance After Road Addition Queries II

The problem involves calculating the shortest path from city 0 to city n-1 after each road addition, leveraging greedy c…

Hard
3245

Alternating Groups III

Solve Alternating Groups III using array manipulation and a binary indexed tree to track maximal alternating sequences e…

Hard
3248

Snake in Matrix

Solve the Snake in Matrix problem by simulating the snake's movement in a grid based on a series of directional commands…

Easy
3250

Find the Count of Monotonic Pairs I

Compute the number of monotonic pairs in an integer array using state transition dynamic programming efficiently.

Hard
3251

Find the Count of Monotonic Pairs II

This problem involves finding the count of monotonic pairs in an array using dynamic programming and combinatorics techn…

Hard
3254

Find the Power of K-Size Subarrays I

Given an array, find the power of all subarrays of size k using a sliding window approach.

Medium
3255

Find the Power of K-Size Subarrays II

Compute the power of all k-size subarrays in an array using sliding window with running state updates efficiently.

Medium
3256

Maximum Value Sum by Placing Three Rooks I

Maximize the value sum by placing three rooks on a chessboard while ensuring they do not attack each other.

Hard
3257

Maximum Value Sum by Placing Three Rooks II

Maximize the sum by placing three non-attacking rooks on a chessboard with dynamic programming.

Hard
3259

Maximum Energy Boost From Two Drinks

Maximize energy boost from two drinks with a state transition dynamic programming approach.

Medium
3261

Count Substrings That Satisfy K-Constraint II

Count Substrings That Satisfy K-Constraint II requires finding valid substrings in a binary string based on a k-constrai…

Hard
3264

Final Array State After K Multiplication Operations I

Solve the problem of determining the final state of an array after multiple multiplication operations using a priority q…

Easy
3265

Count Almost Equal Pairs I

Count Almost Equal Pairs I involves finding pairs of elements that can be made equal by swapping at most one digit.

Medium
3266

Final Array State After K Multiplication Operations II

Optimize the final state of an array after performing k multiplication operations with priority queues.

Hard
3267

Count Almost Equal Pairs II

Count the number of almost equal integer pairs in an array using array scanning and hash lookup efficiently.

Hard
3273

Minimum Amount of Damage Dealt to Bob

Minimize the total damage dealt to Bob using power to eliminate enemies efficiently with greedy approach.

Hard
3275

K-th Nearest Obstacle Queries

Solve the K-th nearest obstacle query problem using array and heap (priority queue) techniques to find distances efficie…

Medium
3276

Select Cells in Grid With Maximum Score

Optimize selection of grid cells using state transition dynamic programming to maximize total sum efficiently.

Hard
3277

Maximum XOR Score Subarray Queries

Solve the Maximum XOR Score Subarray Queries problem using state transition dynamic programming for optimal subarray com…

Hard
3281

Maximize Score of Numbers in Ranges

Maximize Score of Numbers in Ranges asks to find the maximum score by selecting integers within given intervals with a f…

Medium
3282

Reach End of Array With Max Score

Calculate the maximum score to reach the end of an array using greedy jumps based on array values and distances.

Medium
3283

Maximum Number of Moves to Kill All Pawns

Calculate the maximum number of moves to eliminate all pawns using BFS, bitmasking, and precise array position math effi…

Hard
3285

Find Indices of Stable Mountains

Find the indices of stable mountains in an array of mountain heights based on a threshold.

Easy
3286

Find a Safe Walk Through a Grid

Determine if you can safely traverse a binary grid from top-left to bottom-right using limited health points.

Medium
3287

Find the Maximum Sequence Value of Array

Determine the maximum value of a subsequence in an integer array using state transition dynamic programming and bit oper…

Hard
3288

Length of the Longest Increasing Path

Determine the maximum length of an increasing path in a 2D array using binary search over potential path lengths efficie…

Hard
3289

The Two Sneaky Numbers of Digitville

Find the two numbers that appear twice in a list of integers from 0 to n-1 using array scanning plus hash lookup efficie…

Easy
3290

Maximum Multiplication Score

The problem requires selecting four indices from an array to maximize a dynamic score with a transition approach.

Medium
3291

Minimum Number of Valid Strings to Form Target I

Use dynamic programming to split target into the fewest prefixes that match any word prefix, while ruling out dead posit…

Medium
3292

Minimum Number of Valid Strings to Form Target II

Compute the minimum number of valid strings from an array needed to construct a given target string efficiently using dy…

Hard
3295

Report Spam Message

Determine if a message contains at least two banned words using array scanning and hash lookup.

Medium
3296

Minimum Number of Seconds to Make Mountain Height Zero

Determine the minimum seconds required to reduce a mountain to zero height using simultaneous workers efficiently.

Medium
3300

Minimum Element After Replacement With Digit Sum

Replace each number with its digit sum and return the smallest resulting value, using array plus math techniques efficie…

Easy
3301

Maximize the Total Height of Unique Towers

Assign heights to towers ensuring each height is unique and the total sum is maximized using greedy sorting techniques.

Medium
3309

Maximum Possible Number by Binary Concatenation

Determine the largest number achievable by reordering three integers and concatenating their binary forms efficiently.

Medium
3311

Construct 2D Grid Matching Graph Layout

This problem challenges you to construct a 2D grid from an undirected graph using a given set of edges.

Hard
3312

Sorted GCD Pair Queries

Solve the Sorted GCD Pair Queries problem by efficiently counting and locating GCDs of all array pairs using hash mappin…

Hard
3314

Construct the Minimum Bitwise Array I

Learn how to construct an array minimizing each element while matching given primes using bitwise operations efficiently…

Easy
3315

Construct the Minimum Bitwise Array II

Learn to build the minimum array matching a bitwise OR pattern for each prime in nums, focusing on binary optimization.

Medium
3316

Find Maximum Removals From Source String

Determine the maximum number of characters you can remove from source while keeping pattern as a subsequence using array…

Medium
3318

Find X-Sum of All K-Long Subarrays I

Compute the x-sum of every subarray of length k efficiently using array scanning combined with hash lookup techniques.

Easy
3321

Find X-Sum of All K-Long Subarrays II

Calculate the x-sum for every k-length subarray using efficient array scanning and hash-based counting techniques.

Hard
3326

Minimum Division Operations to Make Array Non Decreasing

Determine the minimum number of division operations to make an array non-decreasing using a greedy and invariant-based s…

Medium
3327

Check if DFS Strings Are Palindromes

Determine if strings formed by DFS traversal of a tree are palindromes using array scanning and hash lookups efficiently…

Hard
3331

Find Subtree Sizes After Changes

Calculate the sizes of all subtrees after simultaneous parent changes using array scanning and hash-based counting effic…

Medium
3332

Maximum Points Tourist Can Earn

Calculate the maximum points a tourist can earn by choosing optimal city moves over k days using state transition DP.

Medium
3334

Find the Maximum Factor Score of Array

Calculate the maximum factor score of an integer array by optionally removing one element using LCM and GCD computations…

Medium
3336

Find the Number of Subsequences With Equal GCD

Count all pairs of non-empty subsequences in an integer array whose elements share the same greatest common divisor effi…

Hard
3341

Find Minimum Time to Reach Last Room I

Find Minimum Time to Reach Last Room I challenges you to determine the minimum time to travel in a dungeon with a grid l…

Medium
3342

Find Minimum Time to Reach Last Room II

Calculate the minimum time to reach the last room in a grid with alternating move times using array and graph patterns.

Medium
3346

Maximum Frequency of an Element After Performing Operations I

Maximize the frequency of an element in an array after performing a series of operations to find the best possible resul…

Medium
3347

Maximum Frequency of an Element After Performing Operations II

Determine the maximum frequency of any element after performing limited operations using binary search and sliding windo…

Hard
3349

Adjacent Increasing Subarrays Detection I

Check if an array contains two adjacent strictly increasing subarrays of length k using an array-driven approach efficie…

Easy
3350

Adjacent Increasing Subarrays Detection II

Find the largest k where two adjacent strictly increasing subarrays of length k exist using binary search techniques.

Medium
3351

Sum of Good Subsequences

Calculate the sum of all good subsequences in an array where consecutive numbers differ by exactly one.

Hard
3354

Make Array Elements Equal to Zero

Learn how to transform an integer array to zeros using simulation and directional selection efficiently and reliably.

Easy
3355

Zero Array Transformation I

Transform the given integer array into a zero array using range operations, focusing on prefix sum optimization and care…

Medium
3356

Zero Array Transformation II

Zero Array Transformation II requires determining the minimum query sequence to convert all array elements to zero using…

Medium
3357

Minimize the Maximum Adjacent Element Difference

Minimize the maximum adjacent element difference by filling missing values with two chosen numbers.

Hard
3361

Shift Distance Between Two Strings

Find the minimum cost of transforming one string into another, considering operations between characters.

Medium
3362

Zero Array Transformation III

Zero Array Transformation III requires removing the minimum number of queries to make all elements zero using greedy val…

Medium
3363

Find the Maximum Number of Fruits Collected

Maximize the number of fruits collected by three children navigating a grid dungeon with dynamic programming.

Hard
3364

Minimum Positive Sum Subarray

Find the minimum sum of any subarray of size between l and r with a positive total using efficient sliding window logic.

Easy
3366

Minimum Array Sum

Solve the Minimum Array Sum problem using dynamic programming by tracking states and operations to minimize the sum of a…

Medium
3371

Identify the Largest Outlier in an Array

Identify the largest outlier in an integer array using scanning and hash lookup for efficient detection and validation.

Medium
3375

Minimum Operations to Make Array Values Equal to K

Find the minimum operations to convert an array to all values equal k using array scanning and hash lookup efficiently.

Easy
3376

Minimum Time to Break Locks I

Solve the Minimum Time to Break Locks I problem using state transition dynamic programming to minimize the time to break…

Medium
3378

Count Connected Components in LCM Graph

Determine the number of connected components in an LCM-based graph using array scanning and hash-based connectivity chec…

Hard
3379

Transformed Array

Simulate operations on a circular array to return a transformed result array following specific rules.

Easy
3380

Maximum Area Rectangle With Point Constraints I

Find the maximum area of a rectangle formed by given points on a plane with unique coordinates.

Medium
3381

Maximum Subarray Sum With Length Divisible by K

Find the maximum sum of a subarray where the length of the subarray is divisible by k.

Medium
3382

Maximum Area Rectangle With Point Constraints II

Find the largest rectangle on a plane using given points while avoiding any interior points and optimizing with math and…

Hard
3386

Button with Longest Push Time

Determine which button a child pressed the longest using an array-driven strategy to track time differences efficiently.

Easy
3387

Maximize Amount After Two Days of Conversions

Compute the maximum currency amount after two days using graph traversal and depth-first search for optimal conversions.

Medium
3388

Count Beautiful Splits in an Array

Learn to count all valid beautiful splits in an array using state transition dynamic programming efficiently and accurat…

Medium
3392

Count Subarrays of Length Three With a Condition

Determine how many subarrays of length three satisfy a sum condition on their first and third elements in an array.

Easy
3393

Count Paths With the Given XOR Value

Count the number of paths in a grid where the XOR of all values along the path equals a given number.

Medium
3394

Check if Grid can be Cut into Sections

Determine if an n x n grid can be divided with two horizontal or vertical cuts using rectangle ranges efficiently.

Medium
3395

Subsequences with a Unique Middle Mode I

Count subsequences of size 5 with a unique middle mode in an integer array using hash table and combinatorics.

Hard
3396

Minimum Number of Operations to Make Elements in Array Distinct

Find the minimum number of operations to make all elements of an array distinct.

Easy
3397

Maximum Number of Distinct Elements After Operations

Maximize distinct elements in an array by performing at most one operation on each element.

Medium
3398

Smallest Substring With Identical Characters I

Minimize the length of the longest substring with identical characters after at most numOps changes in a binary string.

Hard
3402

Minimum Operations to Make Columns Strictly Increasing

Calculate the minimum increments to make each column of a matrix strictly increasing using a greedy invariant approach.

Easy
3404

Count Special Subsequences

Count the number of special subsequences in an array of positive integers, focusing on efficient array scanning and hash…

Medium
3409

Longest Subsequence With Decreasing Adjacent Difference

Find the length of the longest subsequence with non-increasing absolute adjacent differences.

Medium
3410

Maximize Subarray Sum After Removing All Occurrences of One Element

Maximize Subarray Sum After Removing All Occurrences of One Element involves finding the optimal subarray sum with one a…

Hard
3411

Maximum Subarray With Equal Products

This problem involves finding the longest subarray where the product equals the LCM multiplied by the GCD, leveraging a …

Easy
3413

Maximum Coins From K Consecutive Bags

Solve the problem of maximizing coins from selecting k consecutive bags, using binary search and sliding window techniqu…

Medium
3414

Maximum Score of Non-overlapping Intervals

Maximize the score of up to 4 non-overlapping intervals, considering their weight and ensuring no overlap between chosen…

Hard
3417

Zigzag Grid Traversal With Skip

Traverse a 2D grid in a zigzag pattern while skipping alternate cells, focusing on array and matrix manipulation challen…

Easy
3418

Maximum Amount of Money Robot Can Earn

Find the maximum amount of money a robot can collect while neutralizing robbers on its path in a grid.

Medium
3420

Count Non-Decreasing Subarrays After K Operations

This problem asks you to count non-decreasing subarrays in a given array after applying at most k operations.

Hard
3423

Maximum Difference Between Adjacent Elements in a Circular Array

Find the maximum absolute difference between adjacent elements in a circular array using a straightforward array-driven …

Easy
3424

Minimum Cost to Make Arrays Identical

Minimize cost to make arrays identical by performing operations with given constraints and a greedy strategy.

Medium
3425

Longest Special Path

Compute the longest downward path in a tree with unique node values using DFS, hash lookup, and careful array scanning.

Hard
3427

Sum of Variable Length Subarrays

Calculate the total sum of all elements in subarrays defined for each index in an array, using the array plus prefix sum…

Easy
3428

Maximum and Minimum Sums of at Most Size K Subsequences

Find the sum of the maximum and minimum elements of subsequences with at most k elements, using dynamic programming.

Medium
3429

Paint House IV

Solve the Paint House IV problem using state transition dynamic programming to minimize the painting costs while adherin…

Medium
3430

Maximum and Minimum Sums of at Most Size K Subarrays

Compute the sum of maximum and minimum values in all subarrays up to size k using efficient stack-based state management…

Hard
3432

Count Partitions with Even Sum Difference

Count the number of partitions with an even sum difference from an array of integers.

Easy
3433

Count Mentions Per User

Calculate how many times each user is mentioned across MESSAGE events, accounting for offline and online statuses effici…

Medium
3434

Maximum Frequency After Subarray Operation

Determine the maximum frequency of a target value k after applying one subarray addition operation efficiently using arr…

Medium
3435

Frequencies of Shortest Supersequences

Compute all unique shortest common supersequences of given words using graph indegree tracking and topological ordering …

Hard
3439

Reschedule Meetings for Maximum Free Time I

Maximize free time by rescheduling up to k non-overlapping meetings within a fixed event using sliding window updates.

Medium
3440

Reschedule Meetings for Maximum Free Time II

Maximize free time by rescheduling at most one meeting using a greedy choice with invariant validation approach for arra…

Medium
3444

Minimum Increments for Target Multiples in an Array

This problem involves incrementing elements of an array to make sure each target element has at least one multiple in th…

Hard
3446

Sort Matrix by Diagonals

Sort Matrix by Diagonals groups cells by diagonal, then sorts bottom-left diagonals descending and top-right diagonals a…

Medium
3447

Assign Elements to Groups with Constraints

Assign elements to groups by size constraints with a sieve-like approach to find suitable element matches efficiently.

Medium
3449

Maximize the Minimum Game Score

Maximizing the minimum score after at most m moves, leveraging binary search and greedy strategies over an array of scor…

Hard
3452

Sum of Good Numbers

The problem asks for the sum of all good numbers in an array based on specific conditions of neighboring elements.

Easy
3453

Separate Squares I

Find the minimum y-coordinate of a horizontal line that balances the areas of squares above and below it.

Medium
3454

Separate Squares II

Separate Squares II requires finding the minimum y-coordinate such that squares' areas are split evenly above and below …

Hard
3457

Eat Pizzas!

Maximize the total weight gained by optimally eating pizzas in groups of four using greedy selection and invariant valid…

Medium
3459

Length of Longest V-Shaped Diagonal Segment

Compute the maximum length of a V-shaped diagonal segment in a 2D integer matrix using state transition dynamic programm…

Hard
3462

Maximum Sum With at Most K Elements

Find the maximum sum by selecting at most k elements from a 2D matrix respecting per-row limits using a greedy strategy.

Medium
3464

Maximize the Distance Between Points on a Square

Select k points on a square boundary to maximize minimum Manhattan distance using binary search and greedy placement str…

Hard
3467

Transform Array by Parity

Transform an array by sorting even numbers first, followed by odd numbers.

Easy
3468

Find the Number of Copy Arrays

Find the number of possible arrays by leveraging bounds and math in this array-based problem.

Medium
3469

Find Minimum Cost to Remove Array Elements

Find the minimum cost to remove all elements from the array with dynamic programming.

Medium
3470

Permutations IV

Find the k-th alternating permutation of numbers 1 to n, ensuring no adjacent numbers share parity, using array and math…

Hard
3471

Find the Largest Almost Missing Integer

Find the largest almost missing integer in an array where it appears in exactly one subarray of size k.

Easy
3473

Sum of K Subarrays With Length at Least M

Maximize the sum of k non-overlapping subarrays of at least length m using dynamic programming and prefix sums efficient…

Medium
3477

Fruits Into Baskets II

Determine the number of fruit types that remain unplaced after all allocations in the "Fruits Into Baskets II" problem.

Easy
3478

Choose K Elements With Maximum Sum

Choose K Elements With Maximum Sum involves sorting and selecting elements based on a specific rule, applying array plus…

Medium
3479

Fruits Into Baskets III

Fruits Into Baskets III requires placing fruits into baskets efficiently using binary search over the answer space for c…

Medium
3480

Maximize Subarrays After Removing One Conflicting Pair

Maximize the count of subarrays after removing one conflicting pair using array traversal and segment tree logic efficie…

Hard
3483

Unique 3-Digit Even Numbers

Given an array of digits, find how many distinct 3-digit even numbers can be formed without repetition of digits and no …

Easy
3484

Design Spreadsheet

Design a spreadsheet that supports setting, retrieving, and resetting values, with the ability to handle formulas refere…

Medium
3485

Longest Common Prefix of K Strings After Removal

Find the longest common prefix length of k strings after removing an element in the array.

Hard
3486

Longest Special Path II

Find the longest downward path in a tree where node values are mostly distinct, allowing one repeat, using array scannin…

Hard
3487

Maximum Unique Subarray Sum After Deletion

Maximize the sum of a subarray after performing deletions, ensuring elements remain unique.

Easy
3488

Closest Equal Element Queries

Find the nearest index with the same value for each query using array scanning combined with hash lookups efficiently.

Medium
3493

Properties Graph

Find the number of connected components in an undirected graph formed by properties arrays, using array scanning and has…

Medium
3494

Find the Minimum Amount of Time to Brew Potions

This problem involves calculating the minimum time required for wizards to brew potions based on their skills and mana u…

Medium
3495

Minimum Operations to Make Array Elements Zero

Minimize operations to reduce array elements to zero, focusing on array manipulation, math, and bit operations for effic…

Hard
3500

Minimum Cost to Divide Array Into Subarrays

Optimize array splits with dynamic programming to minimize costs for the Minimum Cost to Divide Array Into Subarrays pro…

Hard
3501

Maximize Active Section with Trade II

Maximize the number of active sections in a binary string with at most one trade.

Hard
3502

Minimum Cost to Reach Every Position

Calculate the minimum swap costs to reach each position in a line using a precise array-driven strategy for efficiency.

Easy
3505

Minimum Operations to Make Elements Within K Subarrays Equal

Compute the minimum operations to ensure at least k non-overlapping subarrays of size x have all equal elements efficien…

Hard
3507

Minimum Pair Removal to Sort Array I

This problem asks for the minimum number of operations to make an array non-decreasing by removing pairs of elements.

Easy
3508

Implement Router

Efficiently design a Router class to manage network packets with memory limits using array scanning and hash lookups.

Medium
3509

Maximum Product of Subsequences With an Alternating Sum Equal to K

Find the maximum product of a subsequence in an array with an alternating sum equal to a given target.

Hard
3510

Minimum Pair Removal to Sort Array II

The problem asks to find the minimum number of operations to make an array non-decreasing by removing pairs of elements.

Hard
3512

Minimum Operations to Make Array Sum Divisible by K

This problem asks you to find the minimum operations to make the sum of an array divisible by a given integer k.

Easy
3513

Number of Unique XOR Triplets I

Calculate all unique XOR triplet values in a permutation array using array traversal and bit manipulation techniques eff…

Medium
3514

Number of Unique XOR Triplets II

Count all unique XOR results from triplets in an integer array using array traversal and bit manipulation techniques eff…

Medium
3515

Shortest Path in a Weighted Tree

Solve the Shortest Path in a Weighted Tree using binary-tree traversal and efficient state tracking for queries.

Hard
3522

Calculate Score After Performing Instructions

Simulate a series of add and jump instructions on arrays to compute the final score efficiently using array scanning and…

Medium
3523

Make Array Non-decreasing

Determine the maximum size of a non-decreasing array by replacing subarrays with their maximum values efficiently.

Medium
3524

Find X Value of Array I

Determine the x-value of an array using state transition dynamic programming to count valid prefix-suffix operations eff…

Medium
3525

Find X Value of Array II

The "Find X Value of Array II" problem requires calculating the number of ways to remove a suffix from an array such tha…

Hard
3527

Find the Most Common Response

Find the most common survey response after eliminating duplicates within each day, using array scanning and hash lookups…

Medium
3529

Count Cells in Overlapping Horizontal and Vertical Substrings

Efficiently count grid cells appearing in both horizontal and vertical occurrences of a given string pattern using array…

Medium
3530

Maximum Profit from Valid Topological Order in DAG

Solve the Maximum Profit from Valid Topological Order in DAG problem using graph indegree and topological sorting with d…

Hard
3531

Count Covered Buildings

Determine how many buildings in an n x n city are completely surrounded using array scanning and hash lookup efficiently…

Medium
3532

Path Existence Queries in a Graph I

Determine if paths exist between nodes using array scanning and hash lookups for efficient component checks in graphs.

Medium
3533

Concatenated Divisibility

Find the lexicographically smallest permutation of numbers whose concatenation is divisible by k using state transition …

Hard
3534

Path Existence Queries in a Graph II

Solve path existence queries in a graph using binary search on the answer space, focusing on sorted nodes and maximum di…

Hard
3537

Fill a Special Grid

Fill a Special Grid uses recursive divide-and-conquer to populate a 2^n x 2^n matrix with sequential integers uniquely i…

Medium
3538

Merge Operations for Minimum Travel Time

Minimize the total travel time by merging road signs, using dynamic programming to manage state transitions efficiently.

Hard
3539

Find Sum of Array Product of Magical Sequences

Use state transition dynamic programming to count magical index sequences and accumulate weighted products without enume…

Hard
3542

Minimum Operations to Convert All Elements to Zero

Calculate the fewest operations to turn all numbers in an array to zero using subarray minimum elimination strategy.

Medium
3544

Subtree Inversion Sum

This problem involves calculating the maximum possible subtree inversion sum with dynamic programming and binary-tree tr…

Hard
3546

Equal Sum Grid Partition I

Determine if an m x n matrix grid can be split into two non-empty sections with equal sums by making a single horizontal…

Medium
3548

Equal Sum Grid Partition II

Determine if a matrix can be partitioned into two sections with an equal sum using a single cut.

Hard
3550

Smallest Index With Digit Sum Equal to Index

Find the smallest index in an array where the sum of the digits equals the index.

Easy
3551

Minimum Swaps to Sort by Digit Sum

Calculate the minimum swaps to sort an array by digit sum, ensuring correct order with tiebreaker values for efficiency.

Medium
3552

Grid Teleportation Traversal

Find the minimum moves to traverse a 2D grid using standard steps and one-time portal teleports efficiently.

Medium
3553

Minimum Weighted Subgraph With the Required Paths II

Solve the Minimum Weighted Subgraph With the Required Paths II problem by leveraging binary-tree traversal and efficient…

Hard
3559

Number of Ways to Assign Edge Weights II

This problem involves assigning edge weights in a tree and calculating the cost of paths based on these weights.

Hard
3562

Maximum Profit from Trading Stocks with Discounts

Solve the Maximum Profit from Trading Stocks with Discounts problem using binary-tree traversal and dynamic state tracki…

Hard
3566

Partition Array into Two Equal Product Subsets

Determine if you can partition an array into two subsets with equal product using recursion and bit manipulation.

Medium
3567

Minimum Absolute Difference in Sliding Submatrix

Find the minimum absolute difference in each k x k submatrix within a given 2D grid using array and sorting techniques.

Medium
3568

Minimum Moves to Clean the Classroom

Solve the "Minimum Moves to Clean the Classroom" problem using array scanning and hash lookup for an optimized solution.

Medium
3569

Maximize Count of Distinct Primes After Split

Compute the maximum number of distinct prime numbers after sequentially updating array elements with efficient preproces…

Hard
3572

Maximize Y‑Sum by Picking a Triplet of Distinct X‑Values

Select three distinct x-values from arrays to maximize the sum of their corresponding y-values efficiently using hashing…

Medium
3573

Best Time to Buy and Sell Stock V

Maximize profit from stock trades with at most k transactions using state transition dynamic programming for precise dec…

Medium
3574

Maximize Subarray GCD Score

Maximize Subarray GCD Score focuses on maximizing a subarray's score by using at most k doubling operations on an array …

Hard
3575

Maximum Good Subtree Score

Find the maximum sum of values in a tree subtree without repeating any digit across selected nodes using DFS and bitmask…

Hard
3576

Transform Array to All Equal Elements

Transform Array to All Equal Elements requires careful greedy choices and validating invariants to achieve uniformity ef…

Medium
3577

Count the Number of Computer Unlocking Permutations

Calculate the total valid unlocking sequences for computers based on their complexity using array and combinatorics logi…

Medium
3578

Count Partitions With Max-Min Difference at Most K

Count the number of valid ways to partition an array into contiguous segments where max-min difference is at most k.

Medium
3583

Count Special Triplets

Count Special Triplets requires scanning an array while tracking counts of previous and next values efficiently with has…

Medium
3584

Maximum Product of First and Last Elements of a Subsequence

Maximize the product of the first and last elements of any subsequence of size m in an integer array.

Medium
3585

Find Weighted Median Node in Tree

Given a weighted tree and queries, find the weighted median node for each path between two nodes using binary-tree trave…

Hard
3587

Minimum Adjacent Swaps to Alternate Parity

Compute the minimum adjacent swaps to make array elements alternate between even and odd using greedy and invariant chec…

Medium
3588

Find Maximum Area of a Triangle

Find the maximum area of a triangle from 2D coordinates with at least one side parallel to the x-axis or y-axis.

Medium
3589

Count Prime-Gap Balanced Subarrays

Count the number of prime-gap balanced subarrays in an integer array using sliding window techniques and running state u…

Medium
3590

Kth Smallest Path XOR Sum

This problem involves finding the kth smallest distinct XOR sum for nodes in a subtree of a tree structure using binary-…

Hard
3591

Check if Any Element Has Prime Frequency

Check if any element in the array has a prime frequency count, leveraging array scanning and hash table lookup.

Easy
3592

Inverse Coin Change

Recover coin denominations from a numWays array using state transition dynamic programming to reconstruct valid sets eff…

Medium
3593

Minimum Increments to Equalize Leaf Paths

Find the minimum number of increments needed to equalize leaf path scores in a tree with different node costs.

Medium
3594

Minimum Time to Transport All Individuals

Find the minimum time to transport individuals across a river with dynamic environmental conditions and boat capacity.

Hard
3598

Longest Common Prefix Between Adjacent Strings After Removals

Given an array of strings, find the longest common prefix length between adjacent strings after removals at each index.

Medium
3599

Partition Array to Minimize XOR

Partition an integer array into k subarrays to minimize the maximum XOR using state transition dynamic programming effic…

Medium
3603

Minimum Cost Path with Alternating Directions II

This problem focuses on finding the minimum cost path with alternating directions in a grid using dynamic programming.

Medium
3605

Minimum Stability Factor of Array

The problem requires finding the minimum stability factor of an array by utilizing binary search and math-based optimiza…

Hard
3606

Coupon Code Validator

The Coupon Code Validator problem requires filtering and sorting coupons based on specific criteria for validity.

Easy
3607

Power Grid Maintenance

Determine which power stations remain connected after maintenance using array scanning and hash lookups to track compone…

Medium
3618

Split Array by Prime Indices

Split Array by Prime Indices challenges you to separate elements at prime positions and minimize the absolute sum differ…

Medium
3619

Count Islands With Total Value Divisible by K

Count the number of islands in a grid where the sum of each island's values is divisible by a given integer k.

Medium
3620

Network Recovery Pathways

Find the maximum recovery cost of valid paths in a directed acyclic graph where some nodes are offline.

Hard
3623

Count Number of Trapezoids I

Given a list of distinct points, count the number of unique horizontal trapezoids that can be formed by selecting four p…

Medium
3624

Number of Integers With Popcount-Depth Equal to K II

This problem challenges you to efficiently calculate the number of integers with popcount-depth equal to K using array a…

Hard
3625

Count Number of Trapezoids II

Count Number of Trapezoids II requires scanning point pairs and hashing slopes to efficiently find parallel sides in arr…

Hard
3630

Partition Array for Maximum XOR and AND

Partition the array into three subsequences to maximize XOR and AND operations with a greedy approach.

Hard

Related Patterns

Array LeetCode Problems: 1672 Solutions