LeetCode 925: Long Pressed Name
A clear explanation of the Long Pressed Name problem using a two-pointer scan.
264 notes
A clear explanation of the Long Pressed Name problem using a two-pointer scan.
A clear explanation of comparing rational numbers written as decimal strings with optional repeating parts.
A clear explanation of implementing a spellchecker with exact, case-insensitive, and vowel-error matching.
A clear explanation of deleting the minimum number of columns so every remaining row is individually sorted.
A clear explanation of deleting the minimum number of columns so rows become lexicographically sorted.
A clear explanation of checking whether words are sorted according to a custom alien alphabet order.
A clear explanation of the Shifting Letters problem using suffix sums and modulo arithmetic.
A clear explanation of the Backspace String Compare problem using stack simulation and an O(1) space two-pointer scan.
A clear explanation of the Guess the Word interactive problem using candidate filtering and minimax-style guessing.
A clear explanation of the Split Array into Fibonacci Sequence problem using backtracking, leading-zero checks, and 32-bit integer limits.
A clear explanation of the Similar String Groups problem using graph connectivity and union-find.
A clear explanation of the Push Dominoes problem using force propagation and a two-pass scan.
A clear explanation of the Find And Replace in String problem using simultaneous replacement, source matching, and a replacement map.
A clear explanation of the Masking Personal Information problem using string parsing and format-specific masking rules.
A clear explanation of the Positions of Large Groups problem using a simple two-pointer scan.
A clear explanation of Count Unique Characters of All Substrings using contribution counting with previous and next occurrences.
A clear explanation of making a parentheses string valid using greedy counting.
A clear explanation of reversing only English letters while keeping all non-letter characters fixed.
A clear explanation of finding universal words by merging character frequency requirements from words2.
A clear explanation of finding the lexicographically smallest string after queue operations using rotation and sorting.
A clear explanation of counting special-equivalent string groups by building canonical signatures from even and odd positions.
A clear explanation of finding words that match a pattern using bijective character mapping.
A clear explanation of finding uncommon words by counting word frequencies across both sentences.
A clear explanation of finding the kth character in a decoded string without building the full decoded string.
A clear explanation of grouping strings by their shifting sequence using normalized hash keys.
A clear explanation of counting strobogrammatic numbers in a string range using recursive generation and range filtering.
A clear explanation of generating all strobogrammatic numbers of length n using recursion from the inside out.
A clear explanation of the Strobogrammatic Number problem using digit rotation rules and two pointers.
A clear explanation of the Shortest Word Distance III problem, including the special case where both target words are the same.
A clear explanation of the Shortest Word Distance II problem using preprocessing and two pointers.
A clear explanation of the Shortest Word Distance problem using one pass and the latest seen indices of both words.
A clear explanation of checking equality and inequality constraints using union-find.
A clear explanation of finding the lexicographically smallest leaf-to-root string in a binary tree using DFS.
A clear explanation of constructing a string with exact counts of a and b while avoiding three equal consecutive characters.
A clear explanation of designing a time-based key-value store using a hash map and binary search.
A clear explanation of checking whether one swap in a string can make it equal to another string.
A clear explanation of scoring a balanced parentheses string using depth counting.
A clear explanation of finding the minimum number of swaps needed to transform one anagram string into another using BFS.
A clear explanation of solving Largest Time for Given Digits by checking all permutations of four digits.
A clear explanation of solving Delete Columns to Make Sorted by checking each column independently.
A clear explanation of solving Find the Shortest Superstring using pairwise overlaps and bitmask dynamic programming.
A clear explanation of solving DI String Match using a greedy two-pointer construction.
A clear explanation of solving Distinct Subsequences II using dynamic programming and last occurrence tracking.
A clear explanation of solving Reorder Data in Log Files using custom sorting and stable handling of digit logs.
A clear explanation of solving Stamping The Sequence using reverse simulation and BFS-style processing.
A clear explanation of solving Unique Email Addresses using string normalization and a hash set.
A clear explanation of solving Flip String to Monotone Increasing with a one-pass dynamic programming approach.
A string simulation solution for converting each word in a sentence into Goat Latin.
A two-pass solution for computing the shortest distance from each index to the nearest occurrence of a target character.
A suffix-removal solution for finding the shortest reference string that can encode every word.
A hash map and string parsing solution for finding the most frequent non-banned word in a paragraph.
An enumeration solution for reconstructing all valid coordinate pairs after commas, spaces, and decimal points were removed.
A hash map solution for accumulating visit counts across domains and all of their parent subdomains.
A two-pointer group comparison solution for counting how many words can be stretched to match a target string.
A simple simulation solution for counting how many 100-pixel lines are needed to write a string.
A set-based solution for counting how many different Morse code transformations appear among a list of words.
A clear explanation of finding the closest shorthand RGB color by rounding each color channel to the nearest repeated hexadecimal pair.
A clear explanation of checking whether one string can become another by repeated left rotations.
A clear explanation of counting how many words are subsequences of a string using waiting queues.
A clear explanation of rearranging a string so that selected characters follow a custom order.
A clear explanation of counting good numbers after rotating every digit by 180 degrees.
A clear explanation of generating all strings formed by independently changing each letter to lowercase or uppercase.
A clear explanation of validating string transformation using two pointers and movement constraints.
A clear explanation of evaluating arithmetic expressions with parentheses, precedence, and integer division.
A clear explanation of counting how many stones are jewels using a hash set for fast membership checks.
A clear explanation of simplifying algebraic expressions by parsing, substituting variables, and combining polynomial terms.
A clear explanation of rearranging characters so no two adjacent characters are equal using a greedy max heap.
A clear explanation of partitioning a string into the maximum number of parts so each character appears in at most one part.
A clear explanation of making a special binary string lexicographically largest using recursive decomposition and sorting.
A clear explanation of marking matching substrings and merging overlapping bold ranges.
A clear explanation of solving Pyramid Transition Matrix using backtracking and memoization over pyramid rows.
A clear explanation of solving Open the Lock using breadth-first search over lock states.
A clear explanation of converting a range of IPv4 addresses into the shortest list of CIDR blocks using greedy bit manipulation.
A clear explanation of removing line comments and block comments from source code using a state machine.
A clear explanation of merging accounts that share emails using union find and sorted email groups.
A clear explanation of finding the longest buildable word using sorting and a hash set.
A clear explanation of using dynamic programming to minimize the ASCII cost of deletions needed to make two strings equal.
A clear explanation of converting uppercase ASCII letters to lowercase by scanning the string once.
Find the shortest word that contains all required license plate letters using frequency counting.
Support fast prefix and suffix queries by indexing every prefix-suffix combination with the largest word index.
Check sentence similarity with transitive word relationships using union-find.
Evaluate a Lisp-like expression with integers, variables, let bindings, addition, multiplication, and lexical scope.
Check whether two word arrays are sentence-similar using a hash set of symmetric similar word pairs.
Count distinct non-empty palindromic subsequences using interval dynamic programming and duplicate handling.
Find the shortest substring of s1 that contains s2 as a subsequence using dynamic programming.
Parse a chemical formula with nested parentheses, atom names, and multipliers using recursive descent.
Count substrings with equal consecutive groups of 0s and 1s using run lengths.
Find the k most frequent words using frequency counting and custom sorting by count and lexicographical order.
Find the minimum number of stickers needed to form a target string using top-down dynamic programming with memoization.
Find the minimum number of times one string must be repeated so another string becomes a substring.
Find the next valid 24-hour time using only the digits from the current time.
Check whether a string can become a palindrome after deleting at most one character using two pointers.
Check whether a string containing parentheses and wildcard stars can be made valid using a greedy range of possible open counts.
Design a map that supports key-value insertion and prefix-sum queries using a hash map and trie.
Design a dictionary that can check whether a word can match a stored word after changing exactly one character.
A clear explanation of maximizing an integer by swapping at most two digits once.
A clear explanation of minimizing printer turns using interval dynamic programming.
A clear explanation of determining whether a robot returns to the origin after executing movement instructions.
A queue-based simulation for predicting which party wins after senators ban opponents in turn order.
A trie-based solution for replacing each derivative word with the shortest matching root.
A center expansion solution for counting every palindromic substring in a string.
A string parsing solution for reducing a linear equation into coefficient and constant terms.
A dynamic programming solution for counting decodings of a digit string with wildcard characters.
A stack-based solution for computing exclusive execution time from nested start and end logs.
A design solution for storing timestamped logs and retrieving IDs by inclusive time range at a chosen granularity.
A string-marking guide for adding bold tags around all matched words while merging overlapping and adjacent bold regions.
A hash map guide for grouping file paths by identical file content and returning only duplicate groups.
A recursive guide for converting a binary tree into a preorder parenthesized string while preserving the one-to-one mapping between the tree and the string.
A guide to implementing a lazy iterator over a run-length encoded string without fully decompressing it.
A clear explanation of checking whether two strings are anagrams using character frequency counting.
A detailed explanation of evaluating arithmetic expressions with stack-based parsing and operator precedence.
A clear explanation of Group Anagrams using a hash map keyed by each word's sorted character signature.
A clear explanation of Wildcard Matching using dynamic programming over string and pattern prefixes.
A clear explanation of Multiply Strings using grade-school multiplication with digit arrays.
A clear hash map solution for finding common strings with the smallest index sum.
A clear parsing and math solution for evaluating fraction addition and subtraction expressions.
A clear stack-based parser for validating nested XML-like tags with CDATA sections.
A clear design guide for implementing an in-memory file system with directory listing, directory creation, file append, and file read operations.
A clear dynamic programming solution for finding the minimum deletions needed to make two strings equal.
A clear explanation of Permutation in String using a fixed-size sliding window and character frequency counts.
A clear explanation of Find the Closest Palindrome using prefix mirroring and a small candidate set.
A clear explanation of Reverse Words in a String III using two-pointer scanning and string reversal.
A clear explanation of Next Greater Element III using the next permutation algorithm on the digits of an integer.
A clear explanation of Split Concatenated Strings using string reversal choices and enumeration of every possible cut point.
A clear explanation of Optimal Division using the structure of division expressions to build the maximum-value expression.
A clear explanation of Student Attendance Record II using dynamic programming over absence count and late streak.
A clear explanation of Student Attendance Record I using simple string checks and a one-pass counter solution.
A clear explanation of building the final tournament bracket by repeatedly pairing strongest and weakest teams.
A clear explanation of reversing the first k characters in every 2k block of a string.
A clear explanation of finding the minimum difference between 24-hour clock times using minute conversion and sorting.
A clear explanation of multiplying complex numbers represented as strings using algebraic expansion.
A clear explanation of parsing a parenthesized string recursively to construct a binary tree.
A clear explanation of designing a simple URL encoder and decoder using a hash map and generated keys.
A clear explanation of generating minimal unique word abbreviations using grouping and trie prefixes.
A clear explanation of finding the longest dictionary word obtainable as a subsequence using two pointers and sorting rules.
A clear explanation of finding the longest uncommon subsequence among many strings using subsequence checks.
A clear explanation of finding the minimum steps to spell a key on a circular ring using dynamic programming and memoized DFS.
A clear explanation of finding the longest uncommon subsequence between two strings using simple case analysis.
A clear explanation of checking whether a word uses capital letters correctly by counting uppercase letters.
A clear explanation of finding the length of the longest palindromic subsequence using interval dynamic programming.
A clear explanation of converting an integer into its base 7 string representation using repeated division.
A clear explanation of filtering words that can be typed using only one row of an American keyboard.
A clear explanation of solving Zuma Game with DFS, memoization, and chain-removal simulation.
A clear explanation of constructing the lexicographically smallest permutation that matches an I and D pattern.
A clear explanation of reformatting a license key by removing dashes, uppercasing characters, and grouping from the right.
A clear explanation of constructing the magical string by using the string itself as run-length instructions.
A clear explanation of solving the largest subset problem as a two-dimensional 0/1 knapsack over zero and one counts.
A clear explanation of finding all words that can be formed by concatenating at least two shorter words from the same list.
A clear explanation of interval dynamic programming for encoding a string into the shortest k[encoded_string] form.
A clear explanation of validating IPv4 and IPv6 addresses by checking segment count, length, characters, range, and leading-zero rules.
A clear explanation of counting unique substrings that appear in the infinite alphabet wraparound string using dynamic programming by ending character.
A clear explanation of counting how many repeated copies of one string can be obtained as a subsequence of another repeated string.
A clear explanation of checking whether a string can be built by repeating one of its proper substrings.
A clear explanation of sorting characters by decreasing frequency using a hash map and sorting.
Compress a character array in-place using two pointers and grouped character counting.
Evaluate a nested ternary expression using a right-to-left stack parser.
Find all starting indices where an anagram of p appears in s using a fixed-size sliding window.
Count the number of word segments in a string by detecting transitions from spaces to non-space characters.
Find the minimum number of valid one-character gene mutations using breadth-first search.
A clear explanation of building all word squares using backtracking with prefix pruning.
A clear explanation of finding the longest substring that can become all one letter using a sliding window.
A clear explanation of reconstructing digits from shuffled English words using character frequency counts and unique identifying letters.
A clear explanation of checking whether rows and columns read the same using direct index comparison.
A clear explanation of fitting a sentence onto a screen using cyclic string simulation and greedy row transitions.
A clear explanation of adding two non-negative integer strings using manual digit-by-digit simulation.
A clear explanation of the Fizz Buzz problem using direct simulation and divisibility checks.
A clear explanation of finding the shortest abbreviation that does not conflict with any dictionary word using bit masks.
A clear explanation of finding the longest palindrome length that can be built from given letters using character counts.
A clear explanation of checking the minimum edits needed to make a password strong using greedy handling of length, missing character types, and repeated runs.
A clear explanation of validating a word abbreviation using two pointers and number parsing.
A clear explanation of the Remove K Digits problem using a greedy monotonic stack.
A clear explanation of finding the longest substring where every character appears at least k times using divide and conquer.
A clear explanation of decoding nested repeat expressions using a stack.
A clear explanation of checking whether one string is a subsequence of another using two pointers.
A clear explanation of finding the extra character added to a shuffled string using counting and XOR.
A clear explanation of computing the longest absolute path to a file from a serialized file system string using path lengths by depth.
A clear explanation of finding the first non-repeating character in a string using character frequency counting.
A clear explanation of parsing a serialized nested integer string using a stack.
A clear explanation of checking whether one string can be constructed from another using character frequency counting.
A clear explanation of rearranging a string so equal characters are at least k positions apart using a heap and cooldown queue.
A clear explanation of Reverse Vowels of a String using two pointers and selective swaps.
A clear explanation of Reverse String using two pointers and in-place swaps.
A clear explanation of Longest Substring with At Most K Distinct Characters using a sliding window and character counts.
A clear explanation of Palindrome Pairs using reversed-word lookup and palindrome split checks.
A clear explanation of verifying preorder serialization using slot counting without reconstructing the tree.
A clear explanation of Generalized Abbreviation using backtracking to choose whether each character is kept or abbreviated.
A clear explanation of Maximum Product of Word Lengths using bit masks to test disjoint character sets efficiently.
A clear explanation of Remove Duplicate Letters using a greedy monotonic stack.
A clear explanation of Additive Number using split enumeration and deterministic checking.
A clear explanation of Remove Invalid Parentheses using BFS to guarantee the minimum number of removals.
A counting solution for producing the Bulls and Cows hint while handling duplicate digits correctly.
A preorder DFS codec for converting a binary tree to a string and reconstructing the same tree from that string.
A recursive game theory solution with memoization for deciding whether the starting player can force a win.
A simple string scanning solution for generating every possible next state after flipping one consecutive ++ pair into --.
A backtracking solution for matching a pattern string to a target string using a bijective character-to-substring mapping.
A hash map solution for checking whether a pattern string and a space-separated word string form a bijection.
A hash map design for checking whether a word's abbreviation is unique in a dictionary.
A backtracking solution for inserting operators into a numeric string so the expression evaluates to a target value.
A clear explanation of the Integer to English Words problem using three-digit chunks and scale words.
A clear explanation of the Encode and Decode Strings problem using length-prefix encoding.
A clear explanation of the Alien Dictionary problem using graph construction and topological sorting.
A clear explanation of the Palindrome Permutation II problem using character counts and backtracking over half of the palindrome.
A clear explanation of the Palindrome Permutation problem using character parity counting.
A clear explanation of the Binary Tree Paths problem using DFS backtracking to collect every root-to-leaf path.
A clear explanation of evaluating an expression with plus, minus, spaces, and parentheses using a stack.
A clear explanation of building the shortest palindrome by finding the longest palindromic prefix using KMP.
A clear explanation of implementing a Trie with insert, search, and startsWith operations.
A clear explanation of checking whether two strings follow the same character mapping pattern.
A detailed guide to solving Interleaving String with two-dimensional dynamic programming.
A detailed guide to solving Restore IP Addresses with backtracking over four valid IP segments.
A detailed guide to solving Decode Ways with dynamic programming and careful handling of zeroes.
A detailed guide to solving Scramble String with recursive dynamic programming and memoization.
A detailed guide to solving Word Search with depth-first search and backtracking on a grid.
A detailed guide to solving Minimum Window Substring with a sliding window and frequency counters.
A clear explanation of finding repeated 10-letter DNA substrings using a fixed-size sliding window and hash sets.
A clear explanation of reversing the order of words in a character array in-place using two reversals.
A clear explanation of arranging non-negative integers to form the largest possible concatenated number using a custom sort order.
A clear explanation of converting an Excel column title into its numeric index using base 26 accumulation.
A clear explanation of converting a positive integer into an Excel column title using bijective base 26.
A clear explanation of converting a fraction into decimal form and detecting repeating fractional parts with a hash map.
A clear explanation of comparing version strings revision by revision while ignoring leading zeros.
A clear explanation of checking whether two strings are exactly one edit apart using a linear scan.
A clear explanation of finding the longest substring with at most two distinct characters using a sliding window.
A clear explanation of reversing word order while removing extra spaces.
Return all valid sentences formed by inserting spaces into a string so every word belongs to the dictionary, using DFS with memoization.
Decide whether a string can be segmented into dictionary words using dynamic programming over prefixes.
Find the minimum number of cuts needed to split a string into palindromic substrings using palindrome precomputation and dynamic programming.
Generate all ways to split a string so that every piece is a palindrome, using backtracking with palindrome precomputation.
Use breadth-first search to find the shortest transformation sequence length between two words.
Find all shortest word transformation sequences using BFS to build shortest-path parents, then backtracking to reconstruct every answer.
A clear explanation of checking whether a string is a palindrome after ignoring non-alphanumeric characters and case.
A clear explanation of counting distinct subsequences using dynamic programming.
A clear guide to computing the minimum number of insert, delete, and replace operations needed to convert one string into another.
A clear guide to simplifying Unix-style file paths using a stack.
A clear guide to formatting text with greedy line packing and even space distribution.
A clear guide to adding two binary strings using two pointers and a carry.
A clear guide to validating whether a string is a valid number using grammar rules and one left-to-right scan.
A clear guide to solving Length of Last Word by scanning the string from right to left.
A clear explanation of generating the count-and-say sequence using run-length encoding.
A clear explanation of finding the longest well-formed parentheses substring using a stack of indices.
A clear explanation of finding all starting indices where a substring is formed by concatenating every word exactly once.
A clear explanation of finding the first occurrence of one string inside another using direct string matching.
A detailed explanation of generating all well-formed parentheses strings using backtracking.
A detailed explanation of checking whether a bracket string is valid using a stack.
A detailed explanation of generating all possible phone keypad letter combinations using backtracking.
A detailed explanation of finding the longest common prefix among an array of strings by comparing characters column by column.
A detailed explanation of converting a Roman numeral string into an integer using symbol values and the subtraction rule.
A detailed explanation of converting an integer into a Roman numeral using a fixed value-symbol table and greedy subtraction.
A detailed explanation of matching a full string against a simplified regular expression with dot and star using dynamic programming.
A detailed explanation of parsing a string into a 32-bit signed integer with whitespace, sign, digit reading, and clamping rules.
A detailed explanation of converting a string into a zigzag pattern using row simulation.
A detailed explanation of finding the longest palindromic substring using expand-around-center.
A clear explanation of the longest substring problem using sliding window and a hash set.
Linear time suffix array construction using induced sorting of LMS substrings.
Generalized divide and conquer suffix array construction using modulo 7 partitioning.
Linear time suffix array construction using the DC3 divide and conquer strategy.
Build a suffix array using the prefix doubling technique with iterative ranking.
Search for a pattern in a suffix array using LCP information to reduce redundant character comparisons.
Search for a pattern in a text by binary searching the lexicographically sorted suffix array.
Search for a pattern in a text using a suffix tree in time proportional to the pattern length.
Search for a string key in a ternary search tree using character comparisons and three-way branching.
Search for a string or byte key in a radix tree using variable length edge labels.
Search for a string key in a trie whose unary paths are compressed into edge labels.
Search for a string key in a prefix tree by following character transitions.