string
string 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
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…
Longest Palindromic Substring
Find the longest contiguous palindromic substring in a given string using dynamic programming and two-pointer expansion …
Zigzag Conversion
Convert a string into a zigzag pattern across multiple rows and read it line by line efficiently for string manipulation…
String to Integer (atoi)
Convert a string to a 32-bit signed integer by carefully parsing characters, handling signs, and ignoring invalid traili…
Regular Expression Matching
The Regular Expression Matching problem involves checking if a string matches a pattern using '.' and '*'.
Integer to Roman
Convert a given integer to its Roman numeral representation using hash table mapping and decimal place math operations e…
Roman to Integer
Convert a Roman numeral string into an integer using a hash table and mathematical principles to determine value order.
Longest Common Prefix
Find the longest common prefix in an array of strings, returning an empty string if none exists.
Letter Combinations of a Phone Number
Generate all letter combinations a digit string can represent using backtracking with pruning, leveraging hash table map…
Valid Parentheses
Determine if a string of parentheses, brackets, and braces is correctly nested using a stack for proper order validation…
Generate Parentheses
Generate Parentheses requires generating all valid combinations of parentheses with given pairs using backtracking and s…
Find the Index of the First Occurrence in a String
Locate the first occurrence of a substring within a string using a two-pointer scanning strategy and invariant tracking …
Substring with Concatenation of All Words
Find all starting indices of substrings in a string that are concatenations of a given list of words.
Longest Valid Parentheses
Compute the length of the longest well-formed parentheses substring using state transition dynamic programming and stack…
Count and Say
Count and Say requires building the nth sequence term by iteratively applying a run-length encoding on strings of digits…
Multiply Strings
Multiply Strings requires simulating integer multiplication using only string operations without direct numeric conversi…
Wildcard Matching
Implement full wildcard pattern matching using '?' and '*' by applying state transition dynamic programming with careful…
Group Anagrams
Group the anagrams in a list of strings using efficient hash table-based methods, focusing on array scanning.
Length of Last Word
Determine the length of the last word in a string using a focused string-driven approach to handle spaces and trailing c…
Valid Number
Determine if a given string represents a valid number using precise string parsing and character validation rules.
Add Binary
Add Binary involves summing two binary strings and returning the result as a binary string using math and string manipul…
Text Justification
Text Justification requires packing words into lines to match a specified width, ensuring even distribution of spaces.
Simplify Path
Simplify a Unix-style path by transforming it into its canonical form using stack-based state management.
Edit Distance
Determine the minimum number of insertions, deletions, or replacements to transform one string into another using dynami…
Minimum Window Substring
Find the smallest substring of s containing all characters from t using a sliding window with running state updates for …
Word Search
Solve Word Search with backtracking by exploring adjacent cells to match a target word in a grid.
Scramble String
Scramble String is a dynamic programming problem where we determine if one string can be scrambled to form another using…
Decode Ways
Decode Ways is a dynamic programming problem focused on decoding a numeric string to letters using specific mappings.
Restore IP Addresses
Restore all valid IP addresses from a string using backtracking with pruning, avoiding invalid segments or leading zeros…
Interleaving String
The Interleaving String problem requires determining if a string can be formed by interleaving two others, utilizing dyn…
Distinct Subsequences
Compute the number of distinct subsequences of one string matching another using precise state transition dynamic progra…
Valid Palindrome
Check if a given string is a valid palindrome by using two-pointer scanning and invariant tracking techniques.
Word Ladder II
Find all shortest transformation sequences from beginWord to endWord using a dictionary, leveraging backtracking search …
Word Ladder
Find the shortest transformation sequence from a start word to an end word, with each word in the sequence differing by …
Palindrome Partitioning
Find all possible palindrome partitioning of a string using backtracking and dynamic programming.
Palindrome Partitioning II
Determine the minimum cuts required to partition a string into all palindromic substrings using dynamic programming tech…
Word Break
Determine if a string can be fully segmented into dictionary words using array scanning and hash-based lookups for effic…
Word Break II
Given a string and dictionary, return all possible sentences by adding spaces where each word is in the dictionary.
Reverse Words in a String
Reverse Words in a String requires reordering words using precise two-pointer scanning with careful space handling for e…
Compare Version Numbers
Compare two version numbers by checking their individual revisions, considering missing revisions as zero, using a two-p…
Fraction to Recurring Decimal
Convert a fraction into a decimal, handling repeating decimals with parentheses around the repeating part.
Excel Sheet Column Title
Convert a positive integer to its corresponding Excel column title using base-26 math and string manipulation efficientl…
Excel Sheet Column Number
This problem requires converting an Excel column title into its corresponding column number by applying a math and strin…
Largest Number
The problem asks to arrange integers to form the largest possible number, focusing on greedy algorithms and string handl…
Repeated DNA Sequences
Solve Repeated DNA Sequences by sliding a length-10 window and tracking seen patterns with a hash set or bitmask.
Isomorphic Strings
Determine if two strings are isomorphic by checking if one string can be transformed into the other using character repl…
Implement Trie (Prefix Tree)
This problem requires designing a Trie (Prefix Tree) to efficiently store and query strings using hash table concepts fo…
Design Add and Search Words Data Structure
Build a WordDictionary supporting dynamic word addition and search with wildcard matching efficiently using Trie and DFS…
Word Search II
Solve the Word Search II problem using backtracking with pruning to find all words on a board of characters.
Shortest Palindrome
The Shortest Palindrome problem asks to transform a string into a palindrome by adding characters at the beginning, with…
Basic Calculator
Implement a basic calculator to evaluate mathematical expressions, ensuring correct evaluation with stack-based manageme…
Basic Calculator II
Basic Calculator II evaluates a mathematical expression with operators and integers, handling basic arithmetic with prec…
Different Ways to Add Parentheses
Solve Different Ways to Add Parentheses by splitting on each operator and memoizing every subexpression result list.
Valid Anagram
Check if two strings are anagrams using hashing or sorting techniques.
Binary Tree Paths
Find all root-to-leaf paths in a binary tree using DFS and backtracking, constructing strings for each complete path eff…
Integer to English Words
Convert a given integer to its English words representation using mathematical logic and string manipulation.
Expression Add Operators
Expression Add Operators is solved with backtracking that builds multi-digit operands and tracks multiplication preceden…
Word Pattern
Solve Word Pattern by checking a one-to-one mapping between pattern letters and words using hash tables after splitting …
Serialize and Deserialize Binary Tree
This problem asks to serialize and deserialize a binary tree, requiring an efficient approach to handle traversal and st…
Bulls and Cows
Solve the Bulls and Cows problem using hash tables and string manipulation to track exact and misplaced digits.
Remove Invalid Parentheses
Remove the minimum number of invalid parentheses to generate all possible valid strings efficiently using backtracking a…
Additive Number
Additive Number is solved by trying the first two splits, then pruning aggressively while verifying each required sum in…
Remove Duplicate Letters
Remove duplicate letters from a string to produce the lexicographically smallest result using stack-based state manageme…
Maximum Product of Word Lengths
The problem requires finding the maximum product of lengths of two words from an array, where the words don't share comm…
Verify Preorder Serialization of a Binary Tree
Determine if a given string correctly represents a binary tree preorder traversal using state tracking and slot counting…
Palindrome Pairs
Find all pairs of words in a list that form palindromes when concatenated using efficient scanning and hash mapping.
Reverse String
Reverse a character array in-place using a two-pointer scanning technique, ensuring minimal memory and correct index swa…
Reverse Vowels of a String
Reverse Vowels of a String uses a two-pointer approach to reverse the vowels in a string while leaving the consonants in…
Ransom Note
Determine if a ransom note can be constructed from a magazine's letters using hash tables and string counting techniques…
Mini Parser
Deserialize a nested list string using stack-based state management, handling integers and nested lists with depth-first…
First Unique Character in a String
Find the index of the first non-repeating character in a string using efficient queue-driven state processing.
Longest Absolute File Path
Find the length of the longest absolute file path in a filesystem string using stack-based depth tracking efficiently.
Find the Difference
Find the Difference involves identifying the additional letter in one string compared to another, emphasizing hash table…
Is Subsequence
Determine if one string is a subsequence of another using state transition dynamic programming for accurate character ma…
Decode String
Decode a nested encoded string using stack-based state management, handling repeated patterns efficiently with recursion…
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-…
Evaluate Division
Compute the results of division queries from given equations using graph traversal and depth-first search efficiently.
Remove K Digits
Remove K Digits requires selecting which digits to drop using a monotonic stack for the smallest possible integer result…
Convert a Number to Hexadecimal
Convert a 32-bit integer to its hexadecimal string using math operations and careful string manipulation techniques.
Longest Palindrome
Determine the length of the longest palindrome constructible from a given string using greedy counting and frequency tra…
Fizz Buzz
Generate a list from 1 to n replacing multiples of 3 with Fizz, 5 with Buzz, and both with FizzBuzz efficiently.
Add Strings
Given two non-negative integers as strings, sum them and return the result as a string without converting to integers di…
Strong Password Checker
The Strong Password Checker problem challenges you to optimize password strength while minimizing steps using greedy alg…
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…
Longest Repeating Character Replacement
Find the length of the longest substring after at most k replacements using a sliding window and character count trackin…
Minimum Genetic Mutation
Determine the minimum number of single-character gene mutations to reach the target gene using BFS and a hash table look…
Number of Segments in a String
Count the segments of non-space characters in a string by applying a string-driven approach to solve the problem.
Find All Anagrams in a String
Find all starting indices of p's anagrams in s using sliding window and hash table approach.
String Compression
Compress a character array in-place by converting consecutive repeated characters into counts using two-pointer scanning…
Serialize and Deserialize BST
Design an algorithm to serialize and deserialize a binary search tree with efficient traversal and state tracking.
Sort Characters By Frequency
Sort Characters By Frequency requires counting characters efficiently and rearranging a string in descending frequency o…
Repeated Substring Pattern
Check if a string can be constructed by repeating a substring using string matching techniques.
Count The Repetitions
This problem requires counting how many times a repeated string s2 fits as a subsequence within a repeated string s1 usi…
Unique Substrings in Wraparound String
Solve the 'Unique Substrings in Wraparound String' problem using dynamic programming with a state transition approach.
Validate IP Address
Determine whether a given string is a valid IPv4 or IPv6 address using a precise string-driven validation strategy.
Concatenated Words
Find concatenated words by using dynamic programming and depth-first search to identify valid words made of other words …
Ones and Zeroes
Solve the Ones and Zeroes problem using dynamic programming with state transition, focusing on array and string manipula…
Magical String
Count the number of '1's in the first n characters of a magical string using two-pointer scanning and invariant tracking…
License Key Formatting
Reformat a license key string by splitting into groups of size k, converting to uppercase, and handling dashes appropria…
Zuma Game
The Zuma Game involves clearing balls from the board using a limited hand, applying dynamic programming and state transi…
Keyboard Row
Identify all words from a list that can be typed using letters from only one row of a standard American keyboard.
Base 7
Convert any given integer to its base 7 string representation using efficient math and string manipulation techniques.
Freedom Trail
Determine the minimum rotations and button presses to spell a keyword on a circular dial using state transition dynamic …
Longest Palindromic Subsequence
Find the length of the longest palindromic subsequence in a string using precise state transition dynamic programming.
Detect Capital
Detect Capital asks you to determine if a word follows a correct capital usage pattern based on specific rules.
Longest Uncommon Subsequence I
Determine the length of the longest uncommon subsequence between two strings using a direct string comparison strategy.
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 …
Longest Word in Dictionary through Deleting
Find the longest word in the dictionary that can be formed by deleting characters from a string, using two-pointer scann…
Encode and Decode TinyURL
Design a class that encodes and decodes URLs using a URL shortening approach based on hash tables and strings.
Complex Number Multiplication
This problem requires multiplying two complex numbers, given in string form, and returning the result in the same format…
Minimum Time Difference
Calculate the smallest time difference between clock points using array manipulation and mathematical conversions effici…
Reverse String II
Reverse String II requires reversing segments of a string using two-pointer scanning while tracking invariants carefully…
Student Attendance Record I
Determine if a student's attendance record qualifies for an award based on specific criteria for absences and lateness.
Next Greater Element III
Find the next greater integer using the same digits as a given number with precise two-pointer scanning and invariant tr…
Reverse Words in a String III
Reverse Words in a String III involves reversing each word in a sentence using the two-pointer technique.
Find the Closest Palindrome
Identify the nearest palindrome to a given integer string, handling ties and large numbers efficiently using math and st…
Permutation in String
Check if a string contains a permutation of another string using two-pointer scanning and hash table techniques.
Delete Operation for Two Strings
Find the minimum number of steps to make two strings equal by deleting characters, using dynamic programming.
Tag Validator
The Tag Validator problem involves validating a code snippet by parsing through tags using a stack-based state managemen…
Fraction Addition and Subtraction
Solve fraction addition and subtraction by handling expressions, calculating results, and simplifying fractions to irred…
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 …
Construct String from Binary Tree
Given a binary tree, construct a string representation based on preorder traversal while adhering to specific formatting…
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…
Decode Ways II
Decode Ways II is a challenging dynamic programming problem that involves decoding messages with digits and wildcard cha…
Solve the Equation
Solve the equation for the variable 'x' and determine its value or state if there is no solution or infinite solutions.
Palindromic Substrings
Count all palindromic substrings in a given string using state transition dynamic programming for efficient evaluation.
Replace Words
Replace words in a sentence using the shortest root from a dictionary, applying efficient array scanning and hash lookup…
Dota2 Senate
The Dota2 Senate problem involves simulating voting rounds between Radiant and Dire senators until one party wins, using…
Robot Return to Origin
Judge whether a robot returns to the origin after a sequence of moves using string manipulation and simulation.
Strange Printer
Calculate the minimum turns a strange printer needs to print any string using state transition dynamic programming effic…
Implement Magic Dictionary
Design a Magic Dictionary to allow searching with one-character modifications, using Hash Table and String techniques.
Map Sum Pairs
Design and implement a data structure that supports efficient insertion and sum queries based on string prefixes.
Valid Parenthesis String
Solve the Valid Parenthesis String problem by leveraging state transition dynamic programming to handle parentheses and …
Valid Palindrome II
Check if a string can become a palindrome by deleting at most one character using two-pointer scanning and invariant tra…
Repeated String Match
Find the minimum number of repetitions of string a to make string b a substring of the repeated string a.
Stickers to Spell Word
Determine the minimum number of stickers needed to spell a target word using array scanning and hash lookups for efficie…
Top K Frequent Words
Solve Top K Frequent Words by counting each word, then ordering ties alphabetically so frequency wins before lexicograph…
Count Binary Substrings
Count Binary Substrings solves for the number of valid substrings with equal 0's and 1's, grouped consecutively in a bin…
To Lower Case
The "To Lower Case" problem asks you to convert all uppercase letters in a string to lowercase.
Minimum ASCII Delete Sum for Two Strings
This problem focuses on minimizing the ASCII delete sum for two strings by using dynamic programming to find the lowest …
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.
Accounts Merge
Merge accounts by connecting emails and returning each user's sorted email list using array scanning and hash lookup eff…
Remove Comments
Remove comments from a given C++ program source array, handling line and block comments.
Number of Atoms
Compute the exact count of each atom in a chemical formula using stack-based state management and hashing techniques eff…
Count Different Palindromic Subsequences
Count Different Palindromic Subsequences leverages dynamic programming to count non-empty palindromic subsequences in a …
Parse Lisp Expression
Parse Lisp expressions using stack-based state management to evaluate variables and operations.
Prefix and Suffix Search
Design a dictionary to search words by both prefix and suffix using a Trie structure and hash lookups.
Shortest Completing Word
Find the shortest word that completes the license plate by matching all required letters, considering frequency and case…
Open the Lock
Solve the Open the Lock problem using array scanning plus hash lookup to efficiently find the shortest unlock sequence.
Special Binary String
Solve the Special Binary String problem using string manipulation and recursion, optimizing lexicographical order.
Partition Labels
Partition a string into maximal parts so that each letter appears in only one segment, using two-pointer scanning.
Reorganize String
Reorganize a string so that no two adjacent characters are the same, if possible, using a greedy approach.
Basic Calculator IV
Simplify mathematical expressions using stack-based state management, handling variables, operators, and polynomial term…
Jewels and Stones
Given two strings, determine how many of the stones you have are also jewels, considering case sensitivity.
Swap Adjacent in LR String
Transform one string into another by swapping adjacent 'L' and 'R' characters in a sequence of moves.
Letter Case Permutation
Letter Case Permutation involves generating all possible strings by changing the case of each letter in a given string.
Custom Sort String
Sort the string `s` according to a custom order defined by string `order`.
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…
Rotate String
Determine if one string can be rotated into another by repeatedly shifting characters, leveraging string matching techni…
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 …
Number of Lines To Write String
Calculate how many lines are needed to write a string given individual letter widths, constrained to 100 pixels per line…
Expressive Words
Expressive Words challenges you to determine if a word can be transformed into a given string by extending groups of rep…
Subdomain Visit Count
The Subdomain Visit Count problem requires counting the visits to all subdomains of a given domain from a list of count-…
Ambiguous Coordinates
Find all valid 2D coordinate possibilities for an ambiguous input string using backtracking and pruning techniques.
Most Common Word
Find the most frequent non-banned word in a paragraph, excluding punctuation, using an efficient array scan and hash tab…
Short Encoding of Words
Find the minimum length of a reference string encoding an array of words using array scanning and hash lookup efficientl…
Shortest Distance to a Character
Compute the minimum distance from each character in a string to a target character using efficient scanning techniques.
Goat Latin
Convert a sentence to Goat Latin by transforming each word based on vowel rules and incremental suffixes efficiently.
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.
Positions of Large Groups
Identify and return intervals of consecutive, large character groups in a string of lowercase letters.
Masking Personal Information
This problem requires masking sensitive parts of emails and phone numbers using a precise string-driven strategy efficie…
Find And Replace in String
This problem challenges you to perform multiple string replacements at specific indices using a pattern involving array …
Push Dominoes
In the "Push Dominoes" problem, you simulate the falling dominoes based on their initial states and determine their fina…
Similar String Groups
Determine the number of connected groups of similar strings by swapping at most two letters using array scanning and has…
Split Array into Fibonacci Sequence
This problem challenges you to split a string into a Fibonacci-like sequence using backtracking and pruning.
Guess the Word
Master the Guess the Word problem by applying array manipulation, match-counting math, and strategic interactive guessin…
Backspace String Compare
Compare two strings after processing backspaces using efficient two-pointer scanning and careful invariant tracking to e…
Shifting Letters
Given a string and a shift array, shift the first i+1 letters of the string as specified in the array.
K-Similar Strings
K-Similar Strings involves finding the minimal number of swaps to transform one string into another through character sw…
Score of Parentheses
Calculate the score of a balanced parentheses string using stack-based state management for an optimal solution.
Buddy Strings
Determine if two strings can become equal by swapping exactly two letters using a hash table for character tracking.
Decoded String at Index
Decode the string and find the k-th letter efficiently using stack-based state management in this problem.
Uncommon Words from Two Sentences
Find uncommon words from two sentences by counting word frequencies using hash tables.
Find and Replace Pattern
Identify all words matching a given pattern by checking consistent letter mappings using hash tables and array scanning …
Groups of Special-Equivalent Strings
Determine the number of special-equivalent string groups using character swaps at even or odd indices efficiently.
Orderly Queue
Given a string and integer k, rearrange characters to achieve the lexicographically smallest string using limited rotati…
Numbers At Most N Given Digit Set
The 'Numbers At Most N Given Digit Set' problem requires calculating how many numbers can be formed using a given digit …
Valid Permutations for DI Sequence
The problem asks to find the number of valid permutations for a given DI sequence string using dynamic programming and s…
Super Palindromes
Count all super-palindromes in a given numeric range, where each is a palindrome and square of a palindrome.
Word Subsets
Word Subsets is solved by merging words2 into one max-frequency requirement, then scanning words1 against that fixed let…
Reverse Only Letters
Reverse the characters of a string while skipping non-letter characters using a two-pointer technique.
Minimum Add to Make Parentheses Valid
Compute the minimum insertions needed to make a parentheses string valid using efficient stack-based state tracking tech…
Long Pressed Name
Check if a typed string could result from long pressing characters while typing a given name using a two-pointer scan.
Flip String to Monotone Increasing
Minimize the number of flips needed to make a binary string monotone increasing using dynamic programming.
Unique Email Addresses
Identify the count of unique email addresses by normalizing local names and using hash-based lookups efficiently.
Stamping The Sequence
Solve Stamping The Sequence with stack-based state management to convert string s to target using stamp efficiently.
Reorder Data in Log Files
Reorder Data in Log Files requires sorting letter-logs lexicographically while keeping digit-logs in original order for …
Distinct Subsequences II
Find the number of distinct non-empty subsequences of a string using dynamic programming and state transitions.
DI String Match
Reconstruct a permutation from a DI string using two-pointer scanning, carefully tracking the increasing and decreasing …
Find the Shortest Superstring
This problem requires constructing the shortest string containing all input words using state transition dynamic program…
Delete Columns to Make Sorted
The 'Delete Columns to Make Sorted' problem asks to remove unsorted columns from a string array, ensuring all columns ar…
Largest Time for Given Digits
Given four digits, determine the latest valid 24-hour time possible using each digit exactly once with backtracking.
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 …
Delete Columns to Make Sorted II
Solve the "Delete Columns to Make Sorted II" problem by applying greedy choices and invariant validation to string array…
Delete Columns to Make Sorted III
The problem requires minimizing deletions to ensure all strings are lexicographically sorted. Use dynamic programming fo…
Vowel Spellchecker
Implement a spellchecker that matches queries to a wordlist using exact, case-insensitive, and vowel-error rules efficie…
Equal Rational Numbers
Given two rational numbers as strings with possible repeating decimals, determine if they represent the same number.
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…
String Without AAA or BBB
Solve the problem of constructing a string without consecutive 'AAA' or 'BBB' by applying a greedy approach with invaria…
Smallest String Starting From Leaf
Determine the lexicographically smallest string from a leaf to root using binary-tree traversal and careful state tracki…
Satisfiability of Equality Equations
Determine if it's possible to assign values to variables such that all equations are satisfied based on equality and ine…
Find Common Characters
Return an array of common characters from all strings in the given list of words, including duplicates.
Check If Word Is Valid After Substitutions
Determine if a string can be built from repeated 'abc' insertions using stack-based state management, verifying sequence…
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…
Remove Outermost Parentheses
Remove Outermost Parentheses simplifies a valid parentheses string by removing the outermost layers of parentheses in ea…
Camelcase Matching
Camelcase Matching is a medium difficulty problem where you match queries to a given pattern by inserting lowercase lett…
Recover a Tree From Preorder Traversal
Recover a binary tree from its preorder traversal string by tracking node depth and reconstructing child relationships e…
Stream of Characters
Implement a StreamChecker that detects if any suffix of a character stream matches a given list of words using efficient…
Robot Bounded In Circle
Determine if a robot following a repeated instruction sequence stays within a bounded circle using math and string simul…
Longest Duplicate Substring
Find the longest duplicated substring in a string using binary search, sliding window, and rolling hash techniques.
Remove All Adjacent Duplicates In String
Solve Remove All Adjacent Duplicates In String by simulating deletions with a stack that collapses matching neighbors im…
Longest String Chain
Find the longest word chain by scanning arrays and using hash lookups to efficiently track predecessor-successor sequenc…
Lexicographically Smallest Equivalent String
Determine the lexicographically smallest string by modeling character equivalences with union find efficiently.
Greatest Common Divisor of Strings
Find the greatest common divisor string between two strings based on the math and string patterns.
Occurrences After Bigram
Extract the third word in every adjacent triple of words matching a given bigram pattern from a text.
Letter Tile Possibilities
Compute all unique non-empty sequences from given letter tiles using backtracking search with pruning efficiently.
Smallest Subsequence of Distinct Characters
The Smallest Subsequence of Distinct Characters problem asks you to find the lexicographically smallest subsequence of a…
Shortest Common Supersequence
Compute the shortest string containing both given strings as subsequences using state transition dynamic programming eff…
Brace Expansion II
Solve Brace Expansion II efficiently by using stack-based state management to generate all unique combinations of nested…
Parsing A Boolean Expression
Solve the "Parsing A Boolean Expression" problem by evaluating boolean expressions using stack-based state management, r…
Defanging an IP Address
Transform an IPv4 address by replacing each period with '[.]', focusing on a string-driven, direct manipulation approach…
Maximum Nesting Depth of Two Valid Parentheses Strings
This problem challenges you to compute the maximum nesting depth of two valid parentheses strings using stack-based stat…
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…
Longest Common Subsequence
Find the length of the longest common subsequence between two strings using state transition dynamic programming for eff…
Longest Chunked Palindrome Decomposition
Solve the "Longest Chunked Palindrome Decomposition" problem by using dynamic programming and string manipulation techni…
Day of the Year
Calculate the day number of the year based on a given Gregorian calendar date in the format YYYY-MM-DD.
Swap For Longest Repeated Character Substring
Find the maximum length of a repeated character substring after swapping two characters using a sliding window approach …
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…
Last Substring in Lexicographical Order
Identify the lexicographically last substring in a string using two-pointer scanning with invariant tracking efficiently…
Invalid Transactions
Detect invalid transactions by scanning arrays and cross-checking with hash tables for time, amount, and city conflicts …
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…
Can Make Palindrome from Substring
Given a string and queries, determine if a substring can be rearranged and modified to form a palindrome.
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…
Maximum Number of Balloons
Find the maximum number of times the word 'balloon' can be formed from characters of the given string.
Reverse Substrings Between Each Pair of Parentheses
Reverse all substrings within matched parentheses using a stack-based approach for efficient state tracking and reversal…
Smallest String With Swaps
Find the lexicographically smallest string by swapping characters in given pairs of indices.
Get Equal Substrings Within Budget
Optimize substring transformations using a binary search approach to maximize the change within a budget.
Remove All Adjacent Duplicates in String II
Remove all adjacent duplicates in the string using stack-based state management with a given threshold k.
Split a String in Balanced Strings
Split a string into the maximum number of balanced substrings where each substring has an equal number of 'L' and 'R'.
Remove Sub-Folders from the Filesystem
Remove sub-folders in a filesystem by filtering out folders nested inside other folders.
Replace the Substring for Balanced String
Determine the minimum substring length to replace in order to balance a string of Q, W, E, and R characters efficiently.
Maximum Length of a Concatenated String with Unique Characters
Find the maximum length of a concatenated string from an array with all unique characters using backtracking search with…
Minimum Swaps to Make Strings Equal
This problem requires determining the minimum number of swaps to make two strings equal by swapping characters between t…
Minimum Remove to Make Valid Parentheses
Given a string with parentheses and letters, remove the fewest parentheses to produce any valid balanced string efficien…
Maximum Score Words Formed by Letters
Calculate the highest total score by selecting words from a list using available letters, respecting individual letter s…
Search Suggestions System
Design a search suggestion system that provides the top three lexicographically smallest products matching a search word…
Palindrome Partitioning III
Find the minimal character changes to split a string into k palindromes using precise dynamic programming state transiti…
Iterator for Combination
Implement an iterator that generates all combinations of a given length using efficient backtracking with pruning.
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…
Verbal Arithmetic Puzzle
Check if a verbal arithmetic equation can be solved using a valid digit-letter mapping.
Decrypt String from Alphabet to Integer Mapping
Decrypt a string using alphabet-to-integer mapping, considering the presence of '#' as a special delimiter.
Minimum Insertion Steps to Make a String Palindrome
The problem asks to find the minimum number of insertions to convert a string into a palindrome using dynamic programmin…
Distinct Echo Substrings
Count the distinct non-empty substrings of a given string that can be formed as the concatenation of a string with itsel…
Minimum Distance to Type a Word Using Two Fingers
Calculate the minimum total distance to type a word using two fingers on a keyboard, applying dynamic programming.
Print Words Vertically
Transform a string into vertical columns by arranging each word character in array positions while trimming trailing spa…
Break a Palindrome
Given a palindrome, change exactly one character to make it non-palindromic and lexicographically smallest using a greed…
Remove Palindromic Subsequences
This problem challenges you to remove palindromic subsequences from a string with a minimum number of steps using two-po…
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.
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.
Number of Days Between Two Dates
Calculate the exact number of days between two dates using string parsing and arithmetic logic with consistent accuracy.
Rank Teams by Votes
Rank Teams by Votes requires counting position-based votes and resolving ties with array scanning and hash lookup techni…
Increasing Decreasing String
Reorder the string based on a specific algorithm using hash tables and string manipulation.
Find the Longest Substring Containing Vowels in Even Counts
Find the longest substring with even counts of vowels using bitmasking and hash tables.
Generate a String With Characters That Have Odd Counts
Generate a string of n characters where each character appears an odd number of times, using a string-driven approach.
Longest Happy Prefix
Find the longest non-empty prefix of a string that also appears as its suffix, optimizing with rolling hash techniques.
Design Underground System
Design an underground system to calculate travel times between stations using hash tables for efficient lookups and aver…
Find All Good Strings
Find all good strings between two given strings without including a specified evil substring using dynamic programming.
Construct K Palindrome Strings
Determine if a string's characters can be rearranged to form exactly k non-empty palindrome strings using greedy validat…
Number of Steps to Reduce a Number in Binary Representation to One
Determine the number of steps to reduce a binary representation of a number to 1 by following specific rules.
Longest Happy String
Solve the "Longest Happy String" problem using a greedy approach with validation of invariants for constructing the long…
String Matching in an Array
Identify all strings in an array that appear as substrings of other strings, focusing on array and string matching patte…
HTML Entity Parser
Transform a string containing HTML entities into their character equivalents using a hash table for efficient parsing.
The k-th Lexicographical String of All Happy Strings of Length n
Given n and k, find the k-th lexicographical happy string of length n using backtracking search with pruning.
Restore The Array
Calculate the number of arrays that can be restored from a string of digits where each number is within [1, k].
Reformat The String
Reformat The String involves rearranging alphanumeric characters in a string so that no adjacent characters have the sam…
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…
Minimum Number of Frogs Croaking
Determine the minimum number of frogs required to sequentially produce all croaks in a mixed frog croak string efficient…
Maximum Score After Splitting a String
Find the optimal split point in a binary string to maximize zeros on the left and ones on the right efficiently.
Check If a String Can Break Another String
This problem checks whether one string can break another using permutations and a greedy approach for comparison.
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…
Consecutive Characters
Find the power of a string by determining the length of its longest substring with a unique character.
Simplified Fractions
Generate simplified fractions between 0 and 1 with denominators up to a given integer n.
Rearrange Words in a Sentence
Rearrange words in a sentence by their length, maintaining original order for words of equal size for consistent output.
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…
Check If a Word Occurs As a Prefix of Any Word in a Sentence
Determine the first word in a sentence where a given searchWord is a prefix using two-pointer scanning with string match…
Maximum Number of Vowels in a Substring of Given Length
Find the maximum number of vowels in a substring of a given length in a string using a sliding window approach.
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…
Making File Names Unique
This problem requires creating unique folder names by appending suffixes to duplicate names using an array scanning and …
Path Crossing
Check if a path crosses itself on a 2D plane using a hash table to track visited points during traversal.
Minimum Possible Integer After at Most K Adjacent Swaps On Digits
Reorder digits using at most k adjacent swaps to produce the smallest possible integer, leveraging greedy selection effi…
Reformat Date
Reformat Date requires transforming a date string from human-readable form to YYYY-MM-DD using a string-driven strategy …
Number of Substrings With Only 1s
Calculate the number of contiguous substrings containing only 1s in a binary string using a math and string approach eff…
Maximum Number of Non-Overlapping Substrings
Find the maximum number of non-overlapping substrings in a given string, ensuring no two substrings intersect unless one…
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…
Shuffle String
Reorder characters in a string using a given indices array to reconstruct the intended output efficiently and correctly.
Minimum Suffix Flips
Find the minimum number of operations to convert a binary string to a target string using bit flips.
String Compression II
Solve String Compression II with dynamic programming that tracks deletions, run boundaries, and digit-length jumps in co…
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…
Minimum Insertions to Balance a Parentheses String
Compute the minimum insertions to transform a parentheses string into a balanced string using efficient stack tracking.
Find Longest Awesome Substring
Find the maximum-length awesome substring in a numeric string using hash table and bit manipulation for palindrome poten…
Make The String Great
This problem requires removing adjacent characters that cancel each other out, leveraging stack-based state management.
Find Kth Bit in Nth Binary String
Determine the k-th bit in the n-th binary string using a recursive construction that inverts and reverses previous strin…
Thousand Separator
Convert a given integer into a string with dots as thousand separators using a precise string-driven strategy.
Number of Ways to Split a String
Count the number of ways to split a binary string into three non-empty parts with equal numbers of '1's.
Replace All ?'s to Avoid Consecutive Repeating Characters
Solve LeetCode 1576 by scanning left to right and replacing each ? with a letter different from its neighbors.
Minimum Time to Make Rope Colorful
Minimize the time Bob needs to remove balloons to make a rope colorful using dynamic programming with state transitions.
Check If String Is Transformable With Substring Sort Operations
This problem requires checking if string 's' can be transformed into string 't' using substring sort operations.
Rearrange Spaces Between Words
Rearrange spaces between words by distributing them evenly, placing any leftover spaces at the end to match original tex…
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.
Crawler Log Folder
Simulate folder navigation based on a list of operations to determine the current folder depth.
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…
Maximum Nesting Depth of the Parentheses
Find the maximum nesting depth of parentheses in a valid string using stack-based state management.
Split Two Strings to Make Palindrome
Determine if splitting two equal-length strings at a common index can form a palindrome using two-pointer scanning techn…
Largest Substring Between Two Equal Characters
Find the longest substring between two equal characters using a hash table for optimized performance.
Lexicographically Smallest String After Applying Operations
Optimize a string through rotations and additions to get the lexicographically smallest possible result using string man…
Slowest Key
Determine which key had the longest press duration in a sequence using array indices and string mapping, resolving ties …
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…
Number of Ways to Form a Target String Given a Dictionary
Calculate the number of ways to form a target string using words of equal length via state transition dynamic programmin…
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…
Minimum Deletions to Make String Balanced
Determine the minimum number of deletions to transform a string of 'a' and 'b' into a balanced order using DP.
Determine if Two Strings Are Close
Check if two strings can transform into each other using letter swaps and frequency reorganizations, leveraging hash tab…
Check If Two String Arrays are Equivalent
Determine if two string arrays form identical strings by concatenating elements in order, handling subtle array-length m…
Smallest String With A Given Numeric Value
Find the lexicographically smallest string of length n with a given numeric value k using a greedy approach.
Maximum Repeating Substring
Find the maximum number of times a given word repeats consecutively in a string using state transition dynamic programmi…
Goal Parser Interpretation
Interpret the Goal Parser's output by analyzing a command string containing 'G', '()', and '(al)' patterns.
Count the Number of Consistent Strings
Count the number of strings fully composed of allowed characters using array scanning and hash lookup for efficiency.
Partitioning Into Minimum Number Of Deci-Binary Numbers
This problem asks to find the minimum number of deci-binary numbers needed to sum to a given number represented as a str…
Reformat Phone Number
Reformat a phone number by removing spaces and dashes, grouping digits into blocks of 3 or 2, and joining them with dash…
Maximum Binary String After Change
The problem asks to maximize a binary string using specific operations to get the highest possible value.
Determine if String Halves Are Alike
Check if two halves of a string contain the same number of vowels using a character counting approach efficiently.
Maximum Score From Removing Substrings
Compute the highest score by greedily removing specific substrings using a stack to track state transitions efficiently.
Latest Time by Replacing Hidden Digits
Determine the latest valid time by replacing hidden digits using a greedy choice and invariant validation strategy effic…
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.
Palindrome Partitioning IV
The Palindrome Partitioning IV problem asks you to determine if a string can be split into three palindromic substrings.
Minimum Length of String After Deleting Similar Ends
Minimize string length by deleting similar characters from both ends repeatedly using a two-pointer technique.
Largest Merge Of Two Strings
Construct the lexicographically largest merge from two strings using a two-pointer greedy scanning approach efficiently.
Minimum Changes To Make Alternating Binary String
Find the minimum number of changes required to convert a string into an alternating binary string.
Count Number of Homogenous Substrings
This problem requires counting all homogenous substrings in a given string and returning the result modulo 10^9 + 7.
Longest Nice Substring
Find the longest nice substring in a given string using the sliding window technique with running state updates.
Merge Strings Alternately
Merge two strings alternately, starting with the first string, and append extra characters when one string is longer.
Minimum Number of Operations to Move All Balls to Each Box
Solve the problem of finding the minimum operations to move balls to each box using an efficient approach with arrays an…
Maximize Palindrome Length From Subsequences
Maximize Palindrome Length From Subsequences explores dynamic programming to construct the longest palindrome from two s…
Count Items Matching a Rule
Count Items Matching a Rule is an easy problem that tests array and string manipulation with conditions based on specifi…
Sum of Beauty of All Substrings
Calculate the total beauty of all substrings by counting character frequencies and computing frequency differences effic…
Check if Binary String Has at Most One Segment of Ones
Check if a binary string contains at most one contiguous segment of ones.
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.
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.
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…
Evaluate the Bracket Pairs of a String
Quickly evaluate a string with bracketed keys using array scanning and hash table lookups for efficient replacements.
Determine Color of a Chessboard Square
Determine whether a given chessboard square is white or black by converting coordinates using a math plus string approac…
Sentence Similarity III
Sentence Similarity III asks if one sentence can be transformed into another by inserting a sentence inside it.
Truncate Sentence
Truncate a sentence to contain only the first k words by converting it into an array of words.
Minimum Number of Operations to Make String Sorted
Calculate the minimum operations to sort a string using combinatorial math and string manipulation techniques efficientl…
Check if the Sentence Is Pangram
Determine if a given lowercase string contains every English letter using efficient hash table tracking techniques.
Longest Substring Of All Vowels in Order
Find the longest substring of all vowels in order within a given string of vowels using sliding window technique.
Replace All Digits with Characters
Transform a string by replacing digits at odd indices using the preceding character with a shift operation for accurate …
Splitting a String Into Descending Consecutive Values
Check if a string of digits can be split into descending consecutive values where the difference between them is 1.
Minimum Adjacent Swaps to Reach the Kth Smallest Number
Find the minimum number of adjacent swaps to reach the kth smallest wonderful integer from a given number string.
Sorting the Sentence
Reconstruct a shuffled sentence by sorting words using their embedded indices to restore the original sentence order eff…
Minimum Number of Swaps to Make the Binary String Alternating
This problem requires finding the minimum number of swaps to make a binary string alternating or determine if it's impos…
Longer Contiguous Segments of Ones than Zeros
Determine if the longest segment of 1s in a binary string is strictly longer than the longest segment of 0s.
Jump Game VII
The problem asks to determine if we can reach the last index of a binary string, with a set range of jumps between indic…
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…
Check if Word Equals Summation of Two Words
Check if the sum of two word values equals a target word's value by converting letters to their numeric representations.
Maximum Value after Insertion
Solve Maximum Value after Insertion by greedily placing x at the first digit that makes the resulting signed number larg…
Minimum Number of Flips to Make the Binary String Alternating
Find the minimum number of flips to make a binary string alternate, using state transition dynamic programming.
Minimum Cost to Change the Final Value of Expression
Determine the minimum operations to change a boolean expression's result using state transition dynamic programming effi…
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…
Maximum Number of Removable Characters
Use binary search and a subsequence check to find the largest removable prefix that still keeps p inside s.
Largest Odd Number in String
Find the largest odd number in a string using a greedy approach with careful digit inspection and invariant checks.
The Number of Full Rounds You Have Played
Solve this math plus string problem to calculate the number of full rounds played in a chess tournament between login an…
Remove All Occurrences of a Substring
Remove all occurrences of a specified substring from a string using efficient stack-based state management.
Number of Wonderful Substrings
Count the number of wonderful non-empty substrings of a given string based on frequency conditions of characters.
Sum Game
Determine if Alice can force a win in the Sum Game by strategically replacing '?' using a greedy and invariant approach.
Unique Length-3 Palindromic Subsequences
Count all unique length-3 palindromic subsequences in a string efficiently using hash tables and character positions.
Maximum Number of Words You Can Type
Determine how many words can be typed on a malfunctioning keyboard with some broken keys.
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.
Sum of Digits of String After Convert
Convert a lowercase string into digits and repeatedly sum them k times using a direct string plus simulation approach.
Largest Number After Mutating Substring
Find the largest integer by mutating a substring of a number using a mapping array for each digit.
Delete Duplicate Folders in System
Solve Delete Duplicate Folders in System by building a trie, serializing child subtrees, and deleting repeated non-empty…
Delete Characters to Make Fancy String
This problem asks to remove the minimum number of characters from a string to ensure no three consecutive characters are…
Maximum Product of the Length of Two Palindromic Substrings
Find the maximum product of lengths of two non-overlapping odd-length palindromic substrings using string and rolling ha…
Check If String Is a Prefix of Array
Determine if a string is a prefix of an array by concatenating initial elements, using two-pointer scanning efficiently.
Minimum Number of Swaps to Make the String Balanced
Determine the minimum swaps to balance a bracket string using two-pointer scanning with invariant tracking efficiently.
Number of Strings That Appear as Substrings in Word
Count how many strings in an array appear as substrings within a given word by checking each pattern individually.
Minimum Time to Type Word Using Special Typewriter
Compute the minimum typing time by greedily taking the shorter circular move between consecutive letters, then adding on…
Number of Ways to Separate Numbers
Calculate the number of valid non-decreasing integer sequences from a string using state transition dynamic programming …
Find Unique Binary String
Find a binary string of length n not in the input array using array scanning and hash lookup efficiently.
Find the Kth Largest Integer in the Array
This problem asks to find the kth largest integer in an array of string numbers, highlighting sorting and string-based c…
Number of Unique Good Subsequences
Find the number of unique good subsequences of a binary string using dynamic programming and modular arithmetic.
Reverse Prefix of Word
Reverse the prefix of a string starting from index 0 to the first occurrence of a given character.
Maximum Product of the Length of Two Palindromic Subsequences
Find two disjoint palindromic subsequences in a string to maximize the product of their lengths efficiently using dynami…
Final Value of Variable After Performing Operations
Compute the final value of X by simulating each string operation in the array sequentially with careful tracking.
Longest Subsequence Repeated k Times
Find the longest subsequence repeated k times in a string using backtracking search with pruning.
The Score of Students Solving Math Expression
Calculate student scores for a single-digit math expression using state transition dynamic programming to track all vali…
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…
Maximize the Confusion of an Exam
Maximize the Confusion of an Exam requires adjusting at most k answers to create the longest consecutive true or false s…
Minimum Moves to Convert String
Minimize moves to convert a string of 'X' and 'O' to all 'O' by converting three consecutive characters to 'O'.
Smallest K-Length Subsequence With Occurrences of a Letter
Find the lexicographically smallest subsequence of length k with at least repetition occurrences of a given letter using…
Remove Colored Pieces if Both Neighbors are the Same Color
Alice and Bob play a game removing colored pieces; Alice wins if she makes the last valid move.
Check if Numbers Are Ascending in a Sentence
Check if the numbers in a sentence are strictly increasing from left to right using string tokenization.
Number of Valid Words in a Sentence
Count all valid words in a sentence by analyzing each token with precise string-driven validation rules efficiently.
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…
Plates Between Candles
Determine the number of plates between candles in a given substring using binary search and prefix sum techniques.
Number of Valid Move Combinations On Chessboard
Given a set of pieces on a chessboard, calculate the number of valid move combinations without overlap using backtrackin…
Check if an Original String Exists Given Two Encoded Strings
Determine if there exists an original string that could produce both encoded inputs using state transition dynamic progr…
Count Vowel Substrings of a String
Count the number of vowel substrings that include all five vowels in a string.
Vowels of All Substrings
Compute the total number of vowels in all substrings of a given string using efficient state transition dynamic programm…
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…
Decode the Slanted Ciphertext
Decode the Slanted Ciphertext problem requires decoding a slanted cipher using string manipulation and simulation based …
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…
Minimum Number of Food Buckets to Feed the Hamsters
Find the minimum number of food buckets required to feed all hamsters, using dynamic programming and greedy techniques.
Step-By-Step Directions From a Binary Tree Node to Another
Find the shortest path between two nodes in a binary tree and output the directions as a string of 'L', 'R', and 'U'.
Rings and Rods
Count how many rods have all three colors using a hash table to track colors per rod efficiently in strings.
Find First Palindromic String in the Array
Return the first palindromic string from an array of words or an empty string if none exists.
Adding Spaces to a String
Learn to efficiently insert spaces in a string using two-pointer scanning with invariant tracking in linear time.
Maximum Number of Words Found in Sentences
Find the maximum number of words in a single sentence from an array of sentences using array and string processing techn…
Find All Possible Recipes from Given Supplies
Determine all recipes you can prepare given initial supplies and ingredient dependencies, leveraging array scanning and …
Check if a Parentheses String Can Be Valid
Determine if a parentheses string can be transformed into a valid sequence considering locked positions using stack logi…
Execution of All Suffix Instructions Staying in a Grid
Simulate robot moves from every instruction index on an n x n grid, counting valid steps without leaving boundaries.
Check if All A's Appears Before All B's
Determine if all 'a's in a string appear before any 'b's using a direct string-driven check strategy for clarity and cor…
Number of Laser Beams in a Bank
Calculate total laser beams in a bank floor plan using array counting and math logic between security devices on differe…
Capitalize the Title
Capitalize the Title requires transforming each word based on length, applying uppercase and lowercase rules precisely p…
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…
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 …
Divide a String Into Groups of Size k
Divide a string into equal groups of size k, using a fill character to complete the last group if needed.
Number of Ways to Divide a Long Corridor
Calculate the number of ways to split a corridor into sections with exactly two seats using dynamic programming efficien…
Find Substring With Given Hash Value
Locate the first substring of length k whose rolling hash matches the given hashValue using a sliding window approach.
Groups of Strings
Group words into connected sets using operations on characters with string and bit manipulation techniques.
Design Bitset
Master the Design Bitset problem by efficiently managing bit flips, counts, and indexed updates with array and hash look…
Minimum Time to Remove All Cars Containing Illegal Goods
Determine the minimum time to remove all cars with illegal goods using state transition dynamic programming efficiently.
Construct String With Repeat Limit
Construct a lexicographically largest string from a given string with no letter appearing more than a repeatLimit times …
Counting Words With a Given Prefix
Count how many words in a list start with a given prefix.
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…
Minimum Number of Moves to Make Palindrome
The problem challenges you to find the minimum number of adjacent swaps to make a string a palindrome.
Cells in a Range on an Excel Sheet
This problem requires extracting a range of cells from an Excel-like sheet based on a string input and returning them in…
Maximize Number of Subsequences in a String
Maximize the number of subsequences by optimally adding a character to a given string to match a specified pattern.
Minimum White Tiles After Covering With Carpets
Find the minimum number of white tiles visible after optimally placing carpets using state transition dynamic programmin…
Count Collisions on a Road
Count Collisions on a Road is a problem where you calculate the number of car collisions based on their movements in a s…
Longest Substring of One Repeating Character
Solve Longest Substring of One Repeating Character by maintaining mergeable run information under character updates afte…
Number of Ways to Select Buildings
Solve Number of Ways to Select Buildings by counting alternating 3-building patterns with state transitions over the bin…
Sum of Scores of Built Strings
Calculate the sum of scores of built strings by analyzing longest common prefixes with suffixes in a string using effici…
Minimum Number of Operations to Convert Time
The problem asks to find the minimum number of operations to convert one time string to another using specific time incr…
Encrypt and Decrypt Strings
The 'Encrypt and Decrypt Strings' problem involves creating a data structure that can encrypt and decrypt strings using …
Minimize Result by Adding Parentheses to Expression
Enumerate every valid parenthesis placement around the plus sign and choose the expression with the smallest evaluated p…
Calculate Digit Sum of a String
Learn how to repeatedly sum digit groups in a string until its length is at most k using string simulation techniques.
Longest Path With Different Adjacent Characters
Find the longest path in a tree where adjacent nodes have different characters using graph DFS and topological reasoning…
Count Prefixes of a Given String
Count Prefixes of a Given String is a problem that involves finding the number of string prefixes in an array that match…
Remove Digit From Number to Maximize Result
Determine the largest possible number by removing one specific digit using a greedy approach and string iteration.
Total Appeal of A String
Calculate the total appeal of all substrings by counting distinct characters efficiently using state transition DP and h…
Largest 3-Same-Digit Number in String
Find the largest 3-same-digit number within a string of digits using a string-driven solution approach.
Count Number of Texts
Calculate the total number of possible original texts from a pressed key sequence using state transition dynamic program…
Find the K-Beauty of a Number
Calculate the k-beauty of a number by counting substrings of length k that divide the original number evenly using a sli…
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.
Percentage of Letter in String
Calculate the percentage of a specific letter in a string using a direct string-driven counting approach, rounding down …
Check if Number Has Equal Digit Count and Digit Value
Determine if a number's digits correspond to their counts in the string representation.
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…
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.
Apply Discount to Prices
Apply Discount to Prices involves updating a sentence by applying a percentage discount to price words, with precise for…
Design a Text Editor
Design a text editor that supports text manipulation and cursor navigation operations efficiently with linked-list-based…
Strong Password Checker II
Check if a given password meets all strength requirements, including length, character types, and no adjacent repeated c…
Match Substring After Replacement
Determine if a target substring can appear in a string after optional character replacements using given mappings effici…
Naming a Company
The "Naming a Company" problem requires determining the number of valid distinct company names from a list of name ideas…
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.
Longest Binary Subsequence Less Than or Equal to K
Find the longest subsequence in a binary string that forms a number less than or equal to a given integer k.
Count Asterisks
The 'Count Asterisks' problem asks you to count '*' excluding those between pairs of '|' in a string.
Decode the Message
Decode the Message is an easy problem involving hash table mapping for string decoding based on a cipher key.
Move Pieces to Obtain a String
Determine if the pieces in start can be moved to form target using two-pointer scanning and strict left-right movement r…
Query Kth Smallest Trimmed Number
Solve the Query Kth Smallest Trimmed Number problem by efficiently trimming and sorting strings in an array to answer qu…
First Letter to Appear Twice
Find the first letter that repeats in a string using hash table tracking and early detection for efficiency.
Design a Food Rating System
Design a food rating system that tracks and updates ratings of foods, finding the highest rated items by cuisine.
Longest Ideal Subsequence
The Longest Ideal Subsequence problem involves finding the longest subsequence where each character has a difference of …
Construct Smallest Number From DI String
Construct the lexicographically smallest string that fits the increasing and decreasing conditions of a given pattern.
Minimum Recolors to Get K Consecutive Black Blocks
Given a string of blocks, determine the minimum number of recolors needed to get k consecutive black blocks.
Time Needed to Rearrange a Binary String
Calculate the exact seconds required to convert all 01 pairs into 10 in a binary string using state transitions.
Shifting Letters II
Shift letters in a string using a sequence of range-based forward or backward operations efficiently with prefix sums.
Largest Palindromic Number
Form the largest palindromic number from a string of digits while maintaining a valid palindrome structure.
Removing Stars From a String
Remove all stars from a string by simulating the removal process using a stack to manage characters and stars efficientl…
Minimum Amount of Time to Collect Garbage
This problem asks you to find the minimum amount of time needed to collect all garbage in a city, focusing on array and …
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…
Optimal Partition of String
Given a string s, partition it into substrings with unique characters and return the minimum number of substrings.
Count Days Spent Together
Count the total number of days Alice and Bob are in Rome together, given their arrival and departure dates.
Length of the Longest Alphabetical Continuous Substring
Find the length of the longest continuous alphabetical substring from a given string of lowercase letters.
Sum of Prefix Scores of Strings
The 'Sum of Prefix Scores of Strings' problem involves calculating prefix scores for strings based on their occurrences …
Sort the People
Sort the People requires pairing names with heights and sorting them in descending height order efficiently using arrays…
Remove Letter To Equalize Frequency
Determine if removing a single letter from a string can make all remaining letters have identical frequency efficiently.
Maximum Deletions on a String
Find the maximum number of deletions on a string using state transition dynamic programming and rolling hash techniques …
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.
Number of Valid Clock Times
Calculate how many valid digital clock times can be formed by replacing unknown digits in a string format hh:mm.
Determine if Two Events Have Conflict
Compare two same-day time intervals and check whether their inclusive endpoints overlap after converting HH:MM strings i…
Odd String Difference
Identify the one string in an array whose consecutive letter differences deviate from all others using array scanning pl…
Words Within Two Edits of Dictionary
Identify all words in queries that can match dictionary entries with at most two character changes efficiently using arr…
Most Popular Video Creator
Identify the most popular video creator by summing views and selecting their top-viewed video with array and hash patter…
Split Message Based on Limit
Split Message Based on Limit requires dividing a string into parts with length constraints using a calculated suffix pat…
Maximum Number of Non-overlapping Palindrome Substrings
Find the maximum number of non-overlapping palindromic substrings of at least length k in a string using dynamic program…
Number of Beautiful Partitions
The problem involves finding the number of beautiful partitions in a string with dynamic programming and state transitio…
Minimum Penalty for a Shop
Determine the earliest closing hour of a shop to minimize penalty using a string of customer visits and prefix sums.
Count Palindromic Subsequences
Count the number of palindromic subsequences of length 5 in a given string of digits.
Append Characters to String to Make Subsequence
Determine the minimum characters to append to s so t becomes a subsequence using efficient two-pointer scanning techniqu…
Circular Sentence
Determine if a sentence is circular by verifying each word's last character matches the next word's first character effi…
Maximum Value of a String in an Array
The problem requires finding the maximum value of alphanumeric strings in an array based on length or numeric value.
Count Pairs Of Similar Strings
Count similar string pairs by converting each word into a character-set signature and counting matching signatures effic…
Reward Top K Students
Calculate top K student scores by scanning reports and using hash tables for positive and negative word lookups efficien…
Count Anagrams
Learn to count distinct anagrams for a multi-word string using hash tables, math, and combinatorics efficiently.
Shortest Distance to Target String in a Circular Array
Find the shortest distance to a target string in a circular array with either left or right movement options.
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.
Partition String Into Substrings With Values at Most K
Determine the minimum number of substrings from a numeric string such that each substring value does not exceed k using …
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…
Apply Bitwise Operations to Make Strings Equal
Determine if a binary string s can be transformed into target using repeated bitwise operations on paired indices effici…
Count Vowel Strings in Ranges
Count the number of strings that start and end with a vowel in given ranges within an array of words.
Substring XOR Queries
Solve the Substring XOR Queries problem using array scanning and hash lookup to efficiently handle multiple queries on b…
Subsequence With the Minimum Score
Find the minimum score of a string by removing characters from t while maintaining subsequence validity with s.
Find the String with LCP
Determine the lexicographically smallest string matching a given LCP matrix using state transition dynamic programming.
Find the Divisibility Array of a String
Calculate the divisibility array for a string by checking if prefixes are divisible by a given number.
Count the Number of Vowel Strings in Range
Count the Number of Vowel Strings in Range asks to count vowel strings in a subarray of a given word list.
Find the Substring With Maximum Cost
Find the Substring With Maximum Cost requires calculating substring values using a hash lookup for character costs, with…
Find the Longest Balanced Substring of a Binary String
Find the longest balanced substring of a binary string where zeroes precede ones and counts of each are equal.
Minimum Additions to Make Valid String
Determine the minimum insertions required to transform a given string into repeated concatenations of 'abc' using dynami…
Lexicographically Smallest Beautiful String
Find the lexicographically smallest beautiful string larger than the given string using greedy choice and invariant vali…
Number of Senior Citizens
Determine how many passengers are over 60 years old based on their compressed details in an array of strings.
Minimum String Length After Removing Substrings
Determine the smallest string length after repeatedly removing AB or CD substrings using stack-based simulation techniqu…
Lexicographically Smallest Palindrome
Given a string, make it a palindrome with the fewest operations, prioritizing lexicographically smallest result.
Extra Characters in a String
The problem asks for the minimum number of extra characters left after optimally breaking a string into substrings found…
Remove Trailing Zeros From a String
Remove trailing zeros from a string representing a positive integer number.
Minimum Cost to Make All Characters Equal
Find the minimum cost to make all characters of a binary string equal by performing two types of operations.
Minimize String Length
Minimize String Length asks you to reduce a string by removing duplicates using a Hash Table strategy efficiently.
Count of Integers
Count of Integers challenges you to find the number of integers with a digit sum between a given range using dynamic pro…
Find the Longest Semi-Repetitive Substring
Find the length of the longest substring where at most one adjacent pair of digits repeats, using a sliding window appro…
Lexicographically Smallest String After Substring Operation
Given a string, perform operations to make it lexicographically smaller using a greedy approach with substring modificat…
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.
Decremental String Concatenation
Solve the Decremental String Concatenation problem by applying dynamic programming to minimize string length after conca…
Partition String Into Minimum Beautiful Substrings
Partition a binary string into the fewest beautiful substrings using state transition dynamic programming and careful su…
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.
Sort Vowels in a String
Sort Vowels in a String requires identifying vowels in a string and rearranging them in ascending order while keeping co…
Split Strings by Separator
Split Strings by Separator requires iterating through an array of strings and splitting each by a given separator charac…
Shortest String That Contains Three Strings
Find the shortest string containing three given strings using a greedy approach while ensuring it is lexicographically s…
Count Stepping Numbers in Range
Count the stepping numbers in a range using dynamic programming with state transitions between digits.
Faulty Keyboard
Simulate typing on a faulty keyboard where pressing 'i' reverses the string, requiring careful string manipulation track…
Make String a Subsequence Using Cyclic Increments
Determine if str2 can be made a subsequence of str1 by incrementing characters cyclically using at most one operation.
Check if a String Is an Acronym of Words
Check if a string can be formed by concatenating the first letters of each word in a given list.
Furthest Point From Origin
Determine the maximum distance from origin using string moves and counting underscores optimally for efficient calculati…
Check if Strings Can be Made Equal With Operations I
Determine if two strings can be made equal by repeatedly swapping characters at any two indices in each string.
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.
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…
Minimum Operations to Make a Special Number
Minimize operations to make a number divisible by 25 by deleting digits. Use greedy choice and invariant validation.
String Transformation
Find how many ways string s can be transformed into string t in exactly k operations using suffix rotations.
Maximum Odd Binary Number
Rearrange a binary string to form the largest odd binary number using a greedy approach and least significant bit valida…
Apply Operations to Make Two Strings Equal
Apply Operations to Make Two Strings Equal involves transforming binary strings with a cost-based dynamic programming ap…
Longest Unequal Adjacent Groups Subsequence I
Find the longest alternating subsequence in a string array based on a binary group array.
Longest Unequal Adjacent Groups Subsequence II
Find the longest subsequence of indices such that the corresponding strings have a valid Hamming distance and group cons…
Shortest and Lexicographically Smallest Beautiful String
Find the shortest beautiful substring in a binary string and return the lexicographically smallest option efficiently us…
Minimum Changes to Make K Semi-palindromes
Minimize the number of letter changes to partition a string into k semi-palindromes using dynamic programming and two po…
Minimum Number of Changes to Make Binary String Beautiful
This problem involves determining the minimum number of changes to make a binary string beautiful using string-driven st…
High-Access Employees
Identify employees with high system access within one-hour periods based on access logs.
Make Three Strings Equal
Determine the minimum number of operations to make three strings equal by removing rightmost characters from one string …
Separate Black and White Balls
Solve the "Separate Black and White Balls" problem by swapping adjacent balls to group all black balls to the right with…
Find Words Containing Character
Identify all indices of words containing a specific character using array and string traversal techniques efficiently.
Count Beautiful Substrings I
Given a string and a value k, count the number of beautiful substrings where vowels * consonants % k == 0.
Count Beautiful Substrings II
Count Beautiful Substrings II focuses on finding beautiful substrings with hash tables and number theory techniques.
Count Complete Substrings
Count Complete Substrings involves finding substrings where each character appears exactly k times with constraints on a…
Remove Adjacent Almost-Equal Characters
Minimize operations to remove adjacent almost-equal characters using dynamic programming and greedy methods.
Minimum Cost to Convert String I
This problem asks to calculate the minimum cost to convert a string from source to target using specific character trans…
Minimum Cost to Convert String II
Compute the minimum cost to transform source into target using substring replacements with given costs efficiently using…
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…
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…
Palindrome Rearrangement Queries
Given a string and queries, check if rearranging specified substrings can make the string a palindrome.
Count the Number of Powerful Integers
Count the number of powerful integers in a given range by applying state transition dynamic programming with constraints…
Maximize the Number of Partitions After Operations
Maximizing the number of partitions in a string after changing one character and applying partitioning operations using …
Find Beautiful Indices in the Given Array I
Identify all beautiful indices where substring a appears and a nearby substring b exists within distance k efficiently.
Find Beautiful Indices in the Given Array II
Find Beautiful Indices in the Given Array II challenges you to use binary search and string matching techniques.
Minimum Number of Pushes to Type Word I
Calculate the minimum pushes to type a word using a remapped telephone keypad with greedy allocation of letters.
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.
Number of Changing Keys
Count how many times a user switches keys in a typed string, ignoring shift and caps lock variations in characters.
Minimum Time to Revert Word to Initial State I
Determine the minimum seconds to revert a string to its original state using repeated prefix shifts of length k efficien…
Minimum Time to Revert Word to Initial State II
The problem asks to calculate the minimum time required to revert a string to its initial state using specific operation…
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…
Count Prefix and Suffix Pairs I
Count all index pairs where one word is both a prefix and suffix of another, using efficient array and string checks.
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…
Count Prefix and Suffix Pairs II
Count the number of index pairs in a string array where one word is both a prefix and suffix of another using array and …
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…
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…
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.
Count Substrings Starting and Ending with Given Character
Given a string and a character, find the total number of substrings that start and end with that character.
Minimum Deletions to Make String K-Special
Minimize deletions to make a string k-special by adjusting character frequencies.
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…
Longest Common Suffix Queries
Find the index of the string in wordsContainer with the longest common suffix for each query efficiently using array and…
Lexicographically Smallest String After Operations With Constraint
Minimize a string lexicographically using a series of operations constrained by a given integer k.
Score of a String
Calculate the sum of absolute ASCII differences between adjacent characters to score any given string efficiently.
Latest Time You Can Obtain After Replacing Characters
Given a time string with "?" characters, replace them to form the latest valid 12-hour time.
Count the Number of Special Characters I
Count the number of special characters in a given string using hash tables and string manipulation.
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…
Valid Word
Determine if a given string qualifies as a valid word using a string-driven solution pattern with explicit character rul…
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…
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.
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.
Minimum Substring Partition of Equal Character Frequency
Partition a string into substrings with equal character frequencies using dynamic programming and state transitions.
Permutation Difference between Two Strings
Compute the total index difference between two strings by mapping characters and summing their positional distances effi…
String Compression III
Compress a string by repeatedly taking maximal same-character prefixes, following a string-driven solution strategy effi…
Minimum Number of Chairs in a Waiting Room
Calculate the minimum number of chairs needed in a waiting room using string simulation and event tracking efficiently.
Lexicographically Minimum String After Removing Stars
Find the lexicographically smallest string by removing stars using stack-based state management and careful character se…
Clear Digits
Remove all digits from a given string by applying a repeated operation to form the final string without digits.
Find the Encrypted String
In this problem, you need to encrypt a string by shifting each character's position based on a given integer value.
Generate Binary Strings Without Adjacent Zeros
Generate all binary strings of length n without adjacent zeros using backtracking search with pruning for efficient enum…
Construct String with Minimum Cost
This problem asks you to construct a target string using given words at minimal cost using dynamic programming technique…
Lexicographically Smallest String After a Swap
Lexicographically Smallest String After a Swap involves finding the smallest string after swapping adjacent digits with …
Minimum Length of String After Operations
Find the minimum length of a string after performing operations based on character frequency.
Vowels Game in a String
Solve the Vowels Game in a String using optimal moves and string analysis to predict the winner efficiently and accurate…
Maximum Number of Operations to Move Ones to the End
This problem requires finding the maximum number of operations to move ones to the end of a binary string.
Count the Number of Substrings With Dominant Ones
Count the number of substrings in a binary string with dominant ones, using a sliding window approach with state updates…
Snake in Matrix
Solve the Snake in Matrix problem by simulating the snake's movement in a grid based on a series of directional commands…
Count Substrings That Satisfy K-Constraint I
Count all substrings in a binary string that meet a given k-constraint using an efficient sliding window approach.
Find the Largest Palindrome Divisible by K
Compute the largest n-digit integer divisible by k that forms a palindrome using state transition dynamic programming te…
Count Substrings That Satisfy K-Constraint II
Count Substrings That Satisfy K-Constraint II requires finding valid substrings in a binary string based on a k-constrai…
Hash Divided String
Hash Divided String requires splitting a string into equal parts and combining character values modulo 26 to form a new …
Check if Two Chessboard Squares Have the Same Color
Determine if two chessboard squares share the same color using coordinate math and simple string manipulation for quick …
Convert Date to Binary
Convert a given Gregorian date string to its binary format by transforming year, month, and day individually without lea…
Minimum Number of Valid Strings to Form Target I
Use dynamic programming to split target into the fewest prefixes that match any word prefix, while ruling out dead posit…
Minimum Number of Valid Strings to Form Target II
Compute the minimum number of valid strings from an array needed to construct a given target string efficiently using dy…
Report Spam Message
Determine if a message contains at least two banned words using array scanning and hash lookup.
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.
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…
Find the Lexicographically Smallest Valid Sequence
Determine the lexicographically smallest valid index sequence by using state transition dynamic programming over word1 a…
Find the Occurrence of First Almost Equal Substring
Locate the first substring in s that is almost equal to pattern by allowing at most one character mismatch efficiently.
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.
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.
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…
Count The Number of Winning Sequences
Count The Number of Winning Sequences is a dynamic programming challenge involving state transitions based on Alice’s cr…
Find the Sequence of Strings Appeared on the Screen
Simulate Alice typing a target string with a special keyboard that appends letters one by one. Solve using string simula…
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…
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…
Find the Original Typed String I
Determine the length of the original string Alice intended to type by analyzing repeated characters and clumsy key press…
Find Subtree Sizes After Changes
Calculate the sizes of all subtrees after simultaneous parent changes using array scanning and hash-based counting effic…
Find the Original Typed String II
Calculate how many potential original strings Alice might have intended to type, considering her clumsy typing behavior.
Total Characters in String After Transformations I
Calculate the total number of characters in a string after repeated transformations using dynamic programming and freque…
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…
Check Balanced String
Determine if a numeric string is balanced by comparing sums of digits at even and odd positions efficiently.
Count Number of Balanced Permutations
Determine how many distinct permutations of a digit string are balanced using state transition dynamic programming effic…
Smallest Divisible Digit Product II
Find the smallest zero-free number at least as large as num whose digits multiply to a product divisible by t using care…
Count K-Reducible Numbers Less Than N
This problem challenges you to count the K-reducible numbers less than a given binary integer using dynamic programming.
Shift Distance Between Two Strings
Find the minimum cost of transforming one string into another, considering operations between characters.
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.
Maximize Amount After Two Days of Conversions
Compute the maximum currency amount after two days using graph traversal and depth-first search for optimal conversions.
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…
Smallest Substring With Identical Characters II
Find the minimal length of a substring with identical characters using binary search and controlled character flips effi…
Find the Lexicographically Largest String From the Box I
This problem involves finding the lexicographically largest string from a given word using a two-pointer approach.
Substring Matching Pattern
Determine if a pattern containing a single wildcard can match any substring of a given string efficiently.
Find Mirror Score of a String
Calculate the mirror score of a string using stack-based state management for matching letters efficiently and accuratel…
Frequencies of Shortest Supersequences
Compute all unique shortest common supersequences of given words using graph indegree tracking and topological ordering …
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…
Minimum Cost Good Caption
Solve Minimum Cost Good Caption with dynamic programming that builds minimum edit cost while enforcing character runs of…
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.
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…
Maximum Difference Between Even and Odd Frequency II
Find the maximum difference between even and odd character frequencies in substrings using sliding window updates effici…
Count Substrings Divisible By Last Digit
Count the number of substrings in a string divisible by their last non-zero digit using dynamic programming.
Shortest Matching Substring
Find the shortest substring in a string that matches a pattern with exactly two wildcards efficiently using binary searc…
Find Special Substring of Length K
Check efficiently if a string contains a consecutive sequence of length k where all characters match exactly one distinc…
Select K Disjoint Special Substrings
Determine if k non-overlapping special substrings exist in a string using dynamic programming and careful substring trac…
Check If Digits Are Equal in String After Operations I
Simulate repeated adjacent digit sums modulo 10 until two digits remain, then check whether those final digits match.
Check If Digits Are Equal in String After Operations II
Determine if repeated digit-sum operations on a numeric string reduce it to two equal digits using math and string techn…
Longest Palindromic Subsequence After at Most K Operations
Find the longest palindromic subsequence of a string after performing at most k operations to adjust letters.
Lexicographically Smallest Generated String
Generate the lexicographically smallest string by merging str1 and str2 using a greedy approach with invariant checks.
Design Spreadsheet
Design a spreadsheet that supports setting, retrieving, and resetting values, with the ability to handle formulas refere…
Longest Common Prefix of K Strings After Removal
Find the longest common prefix length of k strings after removing an element in the array.
Reverse Degree of a String
Calculate the reverse degree of a string by simulating operations on its characters based on their positions in the alph…
Maximize Active Section with Trade I
Maximize the number of active sections in a binary string by performing at most one trade operation.
Maximize Active Section with Trade II
Maximize the number of active sections in a binary string with at most one trade.
Longest Palindrome After Substring Concatenation I
Compute the maximum palindrome length by concatenating substrings from two strings using state transition dynamic progra…
Longest Palindrome After Substring Concatenation II
Compute the longest palindrome by concatenating substrings from two strings using state transition dynamic programming e…
Smallest Palindromic Rearrangement I
Build the smallest palindrome by sorting the left half counts and mirroring them around the optional middle character.
Smallest Palindromic Rearrangement II
Find the k-th lexicographically smallest palindromic rearrangement of a given palindromic string s.
Count Numbers with Non-Decreasing Digits
Count all integers between l and r whose digits never decrease in base b using state transition dynamic programming effi…
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…
Find the Most Common Response
Find the most common survey response after eliminating duplicates within each day, using array scanning and hash lookups…
Count Cells in Overlapping Horizontal and Vertical Substrings
Efficiently count grid cells appearing in both horizontal and vertical occurrences of a given string pattern using array…
Find Most Frequent Vowel and Consonant
Given a string, calculate the sum of the most frequent vowel and consonant frequencies.
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.
Sum of Largest Prime Substrings
Compute the sum of the three largest unique primes from all substrings using hash table plus math efficiently.
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…
Resulting String After Adjacent Removals
This problem focuses on removing adjacent characters in a string using a stack-based approach until no more operations a…
Lexicographically Smallest String After Adjacent Removals
Find the lexicographically smallest string by repeatedly removing adjacent characters optimally using dynamic programmin…
Minimum Steps to Convert String with Operations
Transform word1 into word2 using minimal operations on substrings with a dynamic programming state transition approach.
Generate Tag for Video Caption
Transform a video caption into a valid hashtag by simulating capitalization rules and truncation for long words efficien…
Partition String
Partition a string into unique segments using hash table and string manipulation.
Longest Common Prefix Between Adjacent Strings After Removals
Given an array of strings, find the longest common prefix length between adjacent strings after removals at each index.
Hexadecimal and Hexatrigesimal Conversion
Solve Hexadecimal and Hexatrigesimal Conversion by converting n squared to base 16 and n cubed to base 36, then joining …
Coupon Code Validator
The Coupon Code Validator problem requires filtering and sorting coupons based on specific criteria for validity.
Process String with Special Operations I
Simulate a series of operations on a string to transform it into the desired result using special characters.
Process String with Special Operations II
Solve the problem of processing strings with special operations like '*' and '#' by simulating the rules left-to-right.
Longest Palindromic Path in Graph
Find the longest path in a graph that forms a palindrome using state transition dynamic programming and bitmask techniqu…