LeetCodechevron_rightCategorieschevron_righthash table
key

hash table

610 problems
Easy: 155Medium: 349Hard: 106

hash table 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
3

Longest Substring Without Repeating Characters

Find the length of the longest substring without repeating characters using a sliding window and hash map to track state…

Medium
12

Integer to Roman

Convert a given integer to its Roman numeral representation using hash table mapping and decimal place math operations e…

Medium
13

Roman to Integer

Convert a Roman numeral string into an integer using a hash table and mathematical principles to determine value order.

Easy
17

Letter Combinations of a Phone Number

Generate all letter combinations a digit string can represent using backtracking with pruning, leveraging hash table map…

Medium
30

Substring with Concatenation of All Words

Find all starting indices of substrings in a string that are concatenations of a given list of words.

Hard
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
41

First Missing Positive

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

Hard
49

Group Anagrams

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

Medium
73

Set Matrix Zeroes

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

Medium
76

Minimum Window Substring

Find the smallest substring of s containing all characters from t using a sliding window with running state updates for …

Hard
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
126

Word Ladder II

Find all shortest transformation sequences from beginWord to endWord using a dictionary, leveraging backtracking search …

Hard
127

Word Ladder

Find the shortest transformation sequence from a start word to an end word, with each word in the sequence differing by …

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
133

Clone Graph

Clone Graph involves cloning a graph using DFS, focusing on graph traversal and neighbor management using hash tables.

Medium
138

Copy List with Random Pointer

This problem requires copying a linked list where each node has a random pointer in addition to the next pointer.

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
141

Linked List Cycle

Determine if a given linked list contains a cycle using pointer manipulation or hashing, focusing on detecting repeated …

Easy
142

Linked List Cycle II

Identify the start of a cycle in a linked list using pointer manipulation, efficiently handling edge cases without modif…

Medium
146

LRU Cache

Implement an efficient LRU Cache using hash table and doubly-linked list to achieve O(1) operations for get and put.

Medium
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
160

Intersection of Two Linked Lists

Given two linked lists, find the node where they intersect or return null if they do not.

Easy
166

Fraction to Recurring Decimal

Convert a fraction into a decimal, handling repeating decimals with parentheses around the repeating part.

Medium
169

Majority Element

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

Easy
187

Repeated DNA Sequences

Solve Repeated DNA Sequences by sliding a length-10 window and tracking seen patterns with a hash set or bitmask.

Medium
202

Happy Number

Determine if a number is happy by repeatedly summing squares of digits using two-pointer scanning to detect cycles effic…

Easy
205

Isomorphic Strings

Determine if two strings are isomorphic by checking if one string can be transformed into the other using character repl…

Easy
208

Implement Trie (Prefix Tree)

This problem requires designing a Trie (Prefix Tree) to efficiently store and query strings using hash table concepts fo…

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
219

Contains Duplicate II

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

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
242

Valid Anagram

Check if two strings are anagrams using hashing or sorting techniques.

Easy
264

Ugly Number II

Find the nth ugly number, where ugly numbers have prime factors limited to 2, 3, and 5.

Medium
268

Missing Number

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

Easy
290

Word Pattern

Solve Word Pattern by checking a one-to-one mapping between pattern letters and words using hash tables after splitting …

Easy
299

Bulls and Cows

Solve the Bulls and Cows problem using hash tables and string manipulation to track exact and misplaced digits.

Medium
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
355

Design Twitter

Design Twitter requires implementing post, follow, unfollow, and news feed retrieval using linked-list pointer manipulat…

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
383

Ransom Note

Determine if a ransom note can be constructed from a magazine's letters using hash tables and string counting techniques…

Easy
387

First Unique Character in a String

Find the index of the first non-repeating character in a string using efficient queue-driven state processing.

Easy
389

Find the Difference

Find the Difference involves identifying the additional letter in one string compared to another, emphasizing hash table…

Easy
391

Perfect Rectangle

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

Hard
395

Longest Substring with At Least K Repeating Characters

Find the length of the longest substring where every character appears at least k times using sliding window and divide-…

Medium
398

Random Pick Index

Random Pick Index involves selecting a random index of a target number in an array with possible duplicates.

Medium
409

Longest Palindrome

Determine the length of the longest palindrome constructible from a given string using greedy counting and frequency tra…

Easy
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
423

Reconstruct Original Digits from English

This problem asks you to reconstruct digits from an out-of-order English string using hash counting and mathematical ded…

Medium
424

Longest Repeating Character Replacement

Find the length of the longest substring after at most k replacements using a sliding window and character count trackin…

Medium
432

All O`one Data Structure

Implement a data structure that tracks string counts and retrieves max or min keys efficiently in constant time.

Hard
433

Minimum Genetic Mutation

Determine the minimum number of single-character gene mutations to reach the target gene using BFS and a hash table look…

Medium
438

Find All Anagrams in a String

Find all starting indices of p's anagrams in s using sliding window and hash table approach.

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
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
451

Sort Characters By Frequency

Sort Characters By Frequency requires counting characters efficiently and rearranging a string in descending frequency o…

Medium
454

4Sum II

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

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
460

LFU Cache

Implement an LFU Cache using linked-list pointer manipulation with constant-time get and put operations for interview sc…

Hard
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
491

Non-decreasing Subsequences

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

Medium
496

Next Greater Element I

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

Easy
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
508

Most Frequent Subtree Sum

Identify the most frequent subtree sum in a binary tree using DFS and hash table tracking for efficient state management…

Medium
519

Random Flip Matrix

Design an optimized algorithm to randomly flip an index in a matrix, using hash tables and math for efficient random sel…

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
525

Contiguous Array

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

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
535

Encode and Decode TinyURL

Design a class that encodes and decodes URLs using a URL shortening approach based on hash tables and strings.

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
567

Permutation in String

Check if a string contains a permutation of another string using two-pointer scanning and hash table techniques.

Medium
575

Distribute Candies

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

Easy
594

Longest Harmonious Subsequence

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

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
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
621

Task Scheduler

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

Medium
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
645

Set Mismatch

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

Easy
648

Replace Words

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

Medium
652

Find Duplicate Subtrees

Identify all duplicate subtrees in a binary tree by efficiently tracking structure and values with depth-first traversal…

Medium
653

Two Sum IV - Input is a BST

Determine if a binary search tree contains two nodes whose values sum to a target using efficient traversal and state tr…

Easy
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
676

Implement Magic Dictionary

Design a Magic Dictionary to allow searching with one-character modifications, using Hash Table and String techniques.

Medium
677

Map Sum Pairs

Design and implement a data structure that supports efficient insertion and sum queries based on string prefixes.

Medium
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
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
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
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
726

Number of Atoms

Compute the exact count of each atom in a chemical formula using stack-based state management and hashing techniques eff…

Hard
736

Parse Lisp Expression

Parse Lisp expressions using stack-based state management to evaluate variables and operations.

Hard
740

Delete and Earn

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

Medium
745

Prefix and Suffix Search

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

Hard
748

Shortest Completing Word

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

Easy
752

Open the Lock

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

Medium
763

Partition Labels

Partition a string into maximal parts so that each letter appears in only one segment, using two-pointer scanning.

Medium
767

Reorganize String

Reorganize a string so that no two adjacent characters are the same, if possible, using a greedy approach.

Medium
770

Basic Calculator IV

Simplify mathematical expressions using stack-based state management, handling variables, operators, and polynomial term…

Hard
771

Jewels and Stones

Given two strings, determine how many of the stones you have are also jewels, considering case sensitivity.

Easy
781

Rabbits in Forest

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

Medium
791

Custom Sort String

Sort the string `s` according to a custom order defined by string `order`.

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
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
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
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
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
828

Count Unique Characters of All Substrings of a Given String

Calculate the sum of unique characters in all substrings of a string using state transition dynamic programming.

Hard
833

Find And Replace in String

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

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
846

Hand of Straights

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

Medium
854

K-Similar Strings

K-Similar Strings involves finding the minimal number of swaps to transform one string into another through character sw…

Hard
859

Buddy Strings

Determine if two strings can become equal by swapping exactly two letters using a hash table for character tracking.

Easy
863

All Nodes Distance K in Binary Tree

Find all nodes at distance K from a target node in a binary tree using various tree traversal techniques.

Medium
865

Smallest Subtree with all the Deepest Nodes

Find the smallest subtree that contains all the deepest nodes in a binary tree.

Medium
869

Reordered Power of 2

Determine if a number's digits can be rearranged to form a power of two using counting and hash-based checks.

Medium
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
884

Uncommon Words from Two Sentences

Find uncommon words from two sentences by counting word frequencies using hash tables.

Easy
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
893

Groups of Special-Equivalent Strings

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

Medium
895

Maximum Frequency Stack

Design a stack-like data structure to manage elements and handle frequent stack operations, including popping the most f…

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
911

Online Election

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

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
916

Word Subsets

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

Medium
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
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
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
947

Most Stones Removed with Same Row or Column

Maximize the number of stones removed from a 2D plane using graph traversal and DFS.

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
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
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
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
970

Powerful Integers

Find all integers that can be expressed as x^i + y^j up to a given bound using a Hash Table plus Math approach.

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
981

Time Based Key-Value Store

Implement a time-based key-value store that retrieves the latest value at a given timestamp using efficient binary searc…

Medium
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
987

Vertical Order Traversal of a Binary Tree

Perform a vertical order traversal of a binary tree, sorting nodes by their values within columns.

Hard
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
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
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
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
1015

Smallest Integer Divisible by K

Find the length of the smallest positive integer divisible by k that consists only of the digit '1'.

Medium
1016

Binary String With Substrings Representing 1 To N

Check if binary string contains all integers from 1 to n as substrings, leveraging sliding window and bit manipulation t…

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
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
1048

Longest String Chain

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

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
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
1079

Letter Tile Possibilities

Compute all unique non-empty sequences from given letter tiles using backtracking search with pruning efficiently.

Medium
1090

Largest Values From Labels

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

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
1123

Lowest Common Ancestor of Deepest Leaves

Find the lowest common ancestor of the deepest leaves in a binary tree using efficient traversal and state tracking tech…

Medium
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
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
1138

Alphabet Board Path

Find the path to type a target string on an alphabet board using directional moves and the 'hash table plus string' patt…

Medium
1146

Snapshot Array

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

Medium
1156

Swap For Longest Repeated Character Substring

Find the maximum length of a repeated character substring after swapping two characters using a sliding window approach …

Medium
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
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
1171

Remove Zero Sum Consecutive Nodes from Linked List

Remove zero-sum consecutive nodes from a linked list by iterating through it, repeatedly deleting sequences that sum to …

Medium
1172

Dinner Plate Stacks

Design a system that manages dinner plate stacks using stack-based state management, handling dynamic plate placement an…

Hard
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
1189

Maximum Number of Balloons

Find the maximum number of times the word 'balloon' can be formed from characters of the given string.

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
1218

Longest Arithmetic Subsequence of Given Difference

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

Medium
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
1248

Count Number of Nice Subarrays

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

Medium
1261

Find Elements in a Contaminated Binary Tree

Recover values in a contaminated binary tree and efficiently check for existence using traversal and state tracking tech…

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
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
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
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
1297

Maximum Number of Occurrences of a Substring

Find the maximum number of occurrences of any valid substring in a given string with specific constraints on letter coun…

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
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
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
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
1347

Minimum Number of Steps to Make Two Strings Anagram

Calculate the minimum steps to transform one string into an anagram of another using character replacements efficiently.

Medium
1348

Tweet Counts Per Frequency

Design an efficient solution to track and retrieve tweet counts over different frequencies using binary search and hash …

Medium
1357

Apply Discount Every n Orders

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

Medium
1358

Number of Substrings Containing All Three Characters

Count all substrings containing at least one of each character a, b, and c using a sliding window approach efficiently.

Medium
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
1370

Increasing Decreasing String

Reorder the string based on a specific algorithm using hash tables and string manipulation.

Easy
1371

Find the Longest Substring Containing Vowels in Even Counts

Find the longest substring with even counts of vowels using bitmasking and hash tables.

Medium
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
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
1396

Design Underground System

Design an underground system to calculate travel times between stations using hash tables for efficient lookups and aver…

Medium
1399

Count Largest Group

Count the number of groups with the largest size by summing digits of numbers from 1 to n using a hash table approach.

Easy
1400

Construct K Palindrome Strings

Determine if a string's characters can be rearranged to form exactly k non-empty palindrome strings using greedy validat…

Medium
1410

HTML Entity Parser

Transform a string containing HTML entities into their character equivalents using a hash table for efficient parsing.

Medium
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
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
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
1443

Minimum Time to Collect All Apples in a Tree

Minimize the time spent to collect all apples in a tree, considering traversal and state tracking with binary tree techn…

Medium
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
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
1461

Check If a String Contains All Binary Codes of Size K

Determine if every possible binary string of length k exists as a substring within a given binary string s efficiently u…

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
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
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
1496

Path Crossing

Check if a path crosses itself on a 2D plane using a hash table to track visited points during traversal.

Easy
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
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
1519

Number of Nodes in the Sub-Tree With the Same Label

Compute the number of nodes in each subtree sharing the same label using DFS with hash table aggregation efficiently.

Medium
1525

Number of Good Ways to Split a String

Count all valid splits of a string where left and right substrings have equal distinct characters, using efficient state…

Medium
1540

Can Convert String in K Moves

Determine if string s can be transformed into t within k moves using character shifts and hash table counting efficientl…

Medium
1542

Find Longest Awesome Substring

Find the maximum-length awesome substring in a numeric string using hash table and bit manipulation for palindrome poten…

Hard
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
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
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
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
1593

Split a String Into the Max Number of Unique Substrings

Maximize unique substrings in a string using backtracking with pruning and hash tables to track substrings.

Medium
1600

Throne Inheritance

Throne Inheritance requires modeling a dynamic family tree with births and deaths to determine the kingdom's inheritance…

Medium
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
1624

Largest Substring Between Two Equal Characters

Find the longest substring between two equal characters using a hash table for optimized performance.

Easy
1630

Arithmetic Subarrays

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

Medium
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
1638

Count Substrings That Differ by One Character

Count all substrings from s that differ by exactly one character from some substring in t using precise substring compar…

Medium
1640

Check Array Formation Through Concatenation

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

Easy
1647

Minimum Deletions to Make Character Frequencies Unique

Determine the minimum deletions needed to ensure all character frequencies in a string are unique using a greedy approac…

Medium
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
1657

Determine if Two Strings Are Close

Check if two strings can transform into each other using letter swaps and frequency reorganizations, leveraging hash tab…

Medium
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
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
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
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
1695

Maximum Erasure Value

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

Medium
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
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
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
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
1737

Change Minimum Characters to Satisfy One of Three Conditions

This problem asks for the minimum operations to change two strings so that one of three conditions is met.

Medium
1742

Maximum Number of Balls in a Box

The problem asks you to find the box with the maximum number of balls based on the sum of digits of ball numbers.

Easy
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
1748

Sum of Unique Elements

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

Easy
1763

Longest Nice Substring

Find the longest nice substring in a given string using the sliding window technique with running state updates.

Easy
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
1781

Sum of Beauty of All Substrings

Calculate the total beauty of all substrings by counting character frequencies and computing frequency differences effic…

Medium
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
1790

Check if One String Swap Can Make Strings Equal

Check if one string swap can make two equal strings using hash table and string counting methods.

Easy
1796

Second Largest Digit in a String

Given a string with alphanumeric characters, find the second largest digit, or return -1 if it doesn’t exist.

Easy
1797

Design Authentication Manager

Implement an AuthenticationManager using linked-list pointer manipulation and a hash map to track token expirations effi…

Medium
1805

Number of Different Integers in a String

Count all unique integers in a string by replacing letters and handling leading zeros correctly with a hash table approa…

Easy
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
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
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
1832

Check if the Sentence Is Pangram

Determine if a given lowercase string contains every English letter using efficient hash table tracking techniques.

Easy
1857

Largest Color Value in a Directed Graph

Compute the maximum color frequency along any valid path in a directed graph using topological ordering and dynamic prog…

Hard
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
1876

Substrings of Size Three with Distinct Characters

Count all substrings of length three in a string where each character is unique using sliding window techniques efficien…

Easy
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
1897

Redistribute Characters to Make All Strings Equal

Determine if you can redistribute characters among strings so that all strings become identical using a counting approac…

Easy
1906

Minimum Absolute Difference Queries

Compute minimum absolute differences for subarrays efficiently using array scanning and hash table lookups, leveraging b…

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
1915

Number of Wonderful Substrings

Count the number of wonderful non-empty substrings of a given string based on frequency conditions of characters.

Medium
1930

Unique Length-3 Palindromic Subsequences

Count all unique length-3 palindromic subsequences in a string efficiently using hash tables and character positions.

Medium
1932

Merge BSTs to Create Single BST

This problem asks you to merge multiple BSTs into a single valid BST by performing a series of operations.

Hard
1935

Maximum Number of Words You Can Type

Determine how many words can be typed on a malfunctioning keyboard with some broken keys.

Easy
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
1941

Check if All Characters Have Equal Number of Occurrences

Check if a string has characters with equal occurrences using hash tables and string manipulation techniques.

Easy
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
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
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
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
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
2013

Detect Squares

Detect Squares requires tracking points on a 2D plane to quickly count all possible axis-aligned squares using efficient…

Medium
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
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
2034

Stock Price Fluctuation

Design an efficient algorithm for managing stock price fluctuations with incorrect and unordered data in a data stream.

Medium
2043

Simple Bank System

Design a simple bank system that processes transactions like withdrawals, deposits, and transfers while managing account…

Medium
2048

Next Greater Numerically Balanced Number

Find the smallest numerically balanced number greater than a given integer using backtracking search and pruning.

Medium
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
2062

Count Vowel Substrings of a String

Count the number of vowel substrings that include all five vowels in a string.

Easy
2068

Check Whether Two Strings are Almost Equivalent

Solve Check Whether Two Strings are Almost Equivalent by counting letters and rejecting any character whose frequency ga…

Easy
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
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
2103

Rings and Rods

Count how many rods have all three colors using a hash table to track colors per rod efficiently in strings.

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
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
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
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
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
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
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
2182

Construct String With Repeat Limit

Construct a lexicographically largest string from a given string with no letter appearing more than a repeatLimit times …

Medium
2186

Minimum Number of Steps to Make Two Strings Anagram II

Compute the fewest character insertions needed to turn two strings into anagrams using hash table frequency counts effic…

Medium
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
2196

Create Binary Tree From Descriptions

Build a binary tree from descriptions of parent-child relationships using array scanning and hash lookup.

Medium
2201

Count Artifacts That Can Be Extracted

Count the number of artifacts that can be extracted after excavating specified grid cells.

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
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
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
2227

Encrypt and Decrypt Strings

The 'Encrypt and Decrypt Strings' problem involves creating a data structure that can encrypt and decrypt strings using …

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
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
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
2262

Total Appeal of A String

Calculate the total appeal of all substrings by counting distinct characters efficiently using state transition DP and h…

Hard
2266

Count Number of Texts

Calculate the total number of possible original texts from a pressed key sequence using state transition dynamic program…

Medium
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
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
2283

Check if Number Has Equal Digit Count and Digit Value

Determine if a number's digits correspond to their counts in the string representation.

Easy
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
2287

Rearrange Characters to Make Target String

Calculate the maximum copies of a target string from letters in s using frequency counting and hash tables efficiently.

Easy
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
2301

Match Substring After Replacement

Determine if a target substring can appear in a string after optional character replacements using given mappings effici…

Hard
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
2309

Greatest English Letter in Upper and Lower Case

Find the greatest English letter that exists in both lowercase and uppercase in a string using a hash table approach.

Easy
2325

Decode the Message

Decode the Message is an easy problem involving hash table mapping for string decoding based on a cipher key.

Easy
2336

Smallest Number in Infinite Set

Design a data structure to handle the smallest missing element in an infinite set, with the ability to add and remove el…

Medium
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
2347

Best Poker Hand

Determine the strongest poker hand from five cards using array scanning and hash table counting techniques efficiently.

Easy
2349

Design a Number Container System

Learn to implement a Number Container System using hash tables and design techniques to efficiently track numbers and in…

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
2351

First Letter to Appear Twice

Find the first letter that repeats in a string using hash table tracking and early detection for efficiency.

Easy
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
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
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
2370

Longest Ideal Subsequence

The Longest Ideal Subsequence problem involves finding the longest subsequence where each character has a difference of …

Medium
2374

Node With Highest Edge Score

Determine the node with the highest edge score in a graph using hash table aggregation and careful index tracking.

Medium
2384

Largest Palindromic Number

Form the largest palindromic number from a string of digits while maintaining a valid palindrome structure.

Medium
2385

Amount of Time for Binary Tree to Be Infected

The problem asks to calculate the number of minutes for an infection to spread across all nodes in a binary tree startin…

Medium
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
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
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
2405

Optimal Partition of String

Given a string s, partition it into substrings with unique characters and return the minimum number of substrings.

Medium
2418

Sort the People

Sort the People requires pairing names with heights and sorting them in descending height order efficiently using arrays…

Easy
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
2423

Remove Letter To Equalize Frequency

Determine if removing a single letter from a string can make all remaining letters have identical frequency efficiently.

Easy
2424

Longest Uploaded Prefix

Calculate the longest continuous uploaded prefix in a video stream efficiently using a mix of binary search and data str…

Medium
2434

Using a Robot to Print the Lexicographically Smallest String

Solve the problem of using a robot to print the lexicographically smallest string with stack-based state management.

Medium
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
2451

Odd String Difference

Identify the one string in an array whose consecutive letter differences deviate from all others using array scanning pl…

Easy
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
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
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
2465

Number of Distinct Averages

Calculate the number of unique averages formed by repeatedly pairing smallest and largest elements efficiently using has…

Easy
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
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
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
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
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
2508

Add Edges to Make Degrees of All Nodes Even

Determine if it's possible to add at most two edges to make all node degrees even in an undirected graph.

Hard
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
2514

Count Anagrams

Learn to count distinct anagrams for a multi-word string using hash tables, math, and combinatorics efficiently.

Hard
2516

Take K of Each Character From Left and Right

Find the minimum number of minutes needed to take at least k of each character from both ends of a string.

Medium
2521

Distinct Prime Factors of Product of Array

Find the number of distinct prime factors in the product of an array of integers.

Medium
2526

Find Consecutive Integers from a Data Stream

Design a data stream checker to identify consecutive integers from a stream, focusing on handling state transitions effi…

Medium
2531

Make Number of Distinct Characters Equal

Determine if a single swap can equalize distinct character counts between two strings using hash tables for tracking fre…

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
2540

Minimum Common Value

Find the smallest integer appearing in both sorted arrays efficiently using array scanning and hash-based lookup techniq…

Easy
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
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
2561

Rearranging Fruits

Solve the problem of rearranging fruit baskets by comparing fruit costs and minimizing swaps using array scanning and ha…

Hard
2564

Substring XOR Queries

Solve the Substring XOR Queries problem using array scanning and hash lookup to efficiently handle multiple queries on b…

Medium
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
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
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
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
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
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
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
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
2641

Cousins in Binary Tree II

Replace each node in a binary tree with the sum of all its cousins by carefully tracking depth and parent relationships.

Medium
2653

Sliding Subarray Beauty

Compute the xth smallest negative number in each sliding subarray using array scanning and hash frequency tracking effic…

Medium
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
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
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
2671

Frequency Tracker

Design a data structure to track values and answer frequency-related queries efficiently using hash tables.

Medium
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
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
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
2716

Minimize String Length

Minimize String Length asks you to reduce a string by removing duplicates using a Hash Table strategy efficiently.

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
2729

Check if The Number is Fascinating

Determine if a 3-digit number is fascinating by checking if the concatenated result of n, 2*n, and 3*n contains all digi…

Easy
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
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
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
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
2766

Relocate Marbles

Relocate marbles to new positions in an array by simulating moves, and return sorted occupied positions.

Medium
2767

Partition String Into Minimum Beautiful Substrings

Partition a binary string into the fewest beautiful substrings using state transition dynamic programming and careful su…

Medium
2768

Number of Black Blocks

Calculate the number of black blocks in a grid given a list of black cell coordinates.

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
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
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
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
2840

Check if Strings Can be Made Equal With Operations II

Check if two strings can be made equal using operations that swap characters with the same parity.

Medium
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
2842

Count K-Subsequences of a String With Maximum Beauty

Determine the number of k-length unique subsequences in a string that maximize the sum of character frequencies efficien…

Hard
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
2848

Points That Intersect With Cars

Count covered integer points by merging overlapping car intervals or marking visited positions on the number line.

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
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
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
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
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
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
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
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
2947

Count Beautiful Substrings I

Given a string and a value k, count the number of beautiful substrings where vowels * consonants % k == 0.

Medium
2949

Count Beautiful Substrings II

Count Beautiful Substrings II focuses on finding beautiful substrings with hash tables and number theory techniques.

Hard
2953

Count Complete Substrings

Count Complete Substrings involves finding substrings where each character appears exactly k times with constraints on a…

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
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
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
2981

Find Longest Special Substring That Occurs Thrice I

Find the longest special substring in a string that appears at least three times, or return -1 if no such substring exis…

Medium
2982

Find Longest Special Substring That Occurs Thrice II

Find the longest special substring that occurs at least three times in a given string using binary search and hash table…

Medium
2983

Palindrome Rearrangement Queries

Given a string and queries, check if rearranging specified substrings can make the string a palindrome.

Hard
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
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
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
3016

Minimum Number of Pushes to Type Word II

Given a word, find the minimum number of pushes to type it on a remapped keypad using a greedy approach.

Medium
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
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
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
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
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
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
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
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
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
3081

Replace Question Marks in String to Minimize Its Value

Minimize the cost of a string with '?' characters by replacing them with letters in lexicographical order while minimizi…

Medium
3083

Existence of a Substring in a String and Its Reverse

Check for any substring of length 2 in a string and its reverse using a hash table and string comparison.

Easy
3085

Minimum Deletions to Make String K-Special

Minimize deletions to make a string k-special by adjusting character frequencies.

Medium
3090

Maximum Length Substring With Two Occurrences

Find the maximum length substring where some substring occurs at least twice using a sliding window and hash mapping str…

Easy
3092

Most Frequent IDs

Track the most frequent ID after each update in a dynamic collection of IDs with changing frequencies.

Medium
3120

Count the Number of Special Characters I

Count the number of special characters in a given string using hash tables and string manipulation.

Easy
3121

Count the Number of Special Characters II

Count the Number of Special Characters II is a medium difficulty string and hash table problem that involves identifying…

Medium
3128

Right Triangles

Count all possible right triangles in a 2D boolean grid using array scanning and hash lookup for efficiency.

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
3137

Minimum Number of Operations to Make Word K-Periodic

The problem requires calculating the minimum number of operations to make a string k-periodic using specific substring r…

Medium
3138

Minimum Length of Anagram Concatenation

The problem asks to find the minimum length of a string t such that s is a concatenation of anagrams of t.

Medium
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
3144

Minimum Substring Partition of Equal Character Frequency

Partition a string into substrings with equal character frequencies using dynamic programming and state transitions.

Medium
3146

Permutation Difference between Two Strings

Compute the total index difference between two strings by mapping characters and summing their positional distances effi…

Easy
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
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
3170

Lexicographically Minimum String After Removing Stars

Find the lexicographically smallest string by removing stars using stack-based state management and careful character se…

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
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
3217

Delete Nodes From Linked List Present in Array

Remove nodes from a linked list if their values exist in a given array.

Medium
3223

Minimum Length of String After Operations

Find the minimum length of a string after performing operations based on character frequency.

Medium
3224

Minimum Array Changes to Make Differences Equal

Minimize changes to make array differences equal by replacing elements within a given range.

Medium
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
3242

Design Neighbor Sum Service

Design a service that computes sums for adjacent and diagonal elements in a 2D grid.

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
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
3272

Find the Count of Good Integers

Count good integers by rearranging digits to form k-palindromic numbers, leveraging hash tables and math techniques.

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
3295

Report Spam Message

Determine if a message contains at least two banned words using array scanning and hash lookup.

Medium
3297

Count Substrings That Can Be Rearranged to Contain a String I

Count the number of valid substrings in word1 that can be rearranged to contain word2 as a prefix.

Medium
3298

Count Substrings That Can Be Rearranged to Contain a String II

Count Substrings That Can Be Rearranged to Contain a String II involves identifying valid substrings with a sliding wind…

Hard
3305

Count of Substrings Containing Every Vowel and K Consonants I

Count all substrings containing every vowel and exactly k consonants using a sliding window and hash map state tracking.

Medium
3306

Count of Substrings Containing Every Vowel and K Consonants II

Count the number of substrings containing all vowels and exactly k consonants using a sliding window technique.

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
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
3325

Count Substrings With K-Frequency Characters I

Calculate the total number of substrings where at least one character repeats k times using a sliding window efficiently…

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
3335

Total Characters in String After Transformations I

Calculate the total number of characters in a string after repeated transformations using dynamic programming and freque…

Medium
3337

Total Characters in String After Transformations II

Calculate the length of a string after repeated transformations using state transition dynamic programming for large t v…

Hard
3351

Sum of Good Subsequences

Calculate the sum of all good subsequences in an array where consecutive numbers differ by exactly one.

Hard
3365

Rearrange K Substrings to Form Target String

Determine if s can be split into k equal substrings and rearranged to match t using a hash table for frequency tracking.

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
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
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
3389

Minimum Operations to Make Character Frequencies Equal

This Hard problem asks to transform a string so all character frequencies match using minimal deletions, leveraging dyna…

Hard
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
3404

Count Special Subsequences

Count the number of special subsequences in an array of positive integers, focusing on efficient array scanning and hash…

Medium
3408

Design Task Manager

Design a Task Manager that can efficiently handle task management operations such as adding, editing, executing, and rem…

Medium
3412

Find Mirror Score of a String

Calculate the mirror score of a string using stack-based state management for matching letters efficiently and accuratel…

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
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
3438

Find Valid Pair of Adjacent Digits in String

Identify the first valid adjacent digit pair in a string where each digit appears exactly as many times as its numeric v…

Easy
3442

Maximum Difference Between Even and Odd Frequency I

Find the maximum difference between the frequency of characters in a string with odd and even frequencies.

Easy
3443

Maximum Manhattan Distance After K Changes

Solve Maximum Manhattan Distance After K Changes by scanning prefixes and testing the four diagonal target pairs with li…

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
3458

Select K Disjoint Special Substrings

Determine if k non-overlapping special substrings exist in a string using dynamic programming and careful substring trac…

Medium
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
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
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
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
3518

Smallest Palindromic Rearrangement II

Find the k-th lexicographically smallest palindromic rearrangement of a given palindromic string s.

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
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
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
3541

Find Most Frequent Vowel and Consonant

Given a string, calculate the sum of the most frequent vowel and consonant frequencies.

Easy
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
3543

Maximum Weighted K-Edge Path

Determine the maximum sum of edge weights for a k-edge path in a DAG using state transition dynamic programming efficien…

Medium
3545

Minimum Deletions for At Most K Distinct Characters

You need to delete characters in a string to reduce its distinct characters to at most k.

Easy
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
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
3556

Sum of Largest Prime Substrings

Compute the sum of the three largest unique primes from all substrings using hash table plus math efficiently.

Medium
3557

Find Maximum Number of Non Intersecting Substrings

Determine the maximum number of non-overlapping substrings in a word, each at least four characters and matching start-e…

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
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
3583

Count Special Triplets

Count Special Triplets requires scanning an array while tracking counts of previous and next values efficiently with has…

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
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
3597

Partition String

Partition a string into unique segments using hash table and string manipulation.

Medium
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
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
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

Related Patterns

Hash Table LeetCode Problems: 610 Solutions