LeetCode 925: Long Pressed Name
A clear explanation of the Long Pressed Name problem using a two-pointer scan.
99 notes
A clear explanation of the Long Pressed Name problem using a two-pointer scan.
A clear explanation of the Maximize Distance to Closest Person problem using gaps between occupied seats.
A clear explanation of the Longest Mountain in Array problem using peak detection and two-pointer expansion.
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 Push Dominoes problem using force propagation and a two-pass scan.
A clear explanation of the Flipping an Image problem using row reversal, bit inversion, and an in-place two-pointer method.
A clear explanation of the Positions of Large Groups problem using a simple two-pointer scan.
A clear explanation of the Most Profit Assigning Work problem using sorting, greedy choice, and two pointers.
A clear explanation of counting index triplets with duplicate values using frequency counts and combinatorics.
A clear explanation of placing even numbers at even indices and odd numbers at odd indices using two pointers.
A clear explanation of reversing only English letters while keeping all non-letter characters fixed.
A clear explanation of sorting an array by parity using a two-pointer partition method.
A clear explanation of minimizing rescue boats using sorting, greedy choice, and two pointers.
A clear explanation of finding the middle node of a singly linked list using slow and fast pointers.
A clear explanation of the Strobogrammatic Number problem using digit rotation rules and two pointers.
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 finding intersections between two sorted disjoint interval lists using two pointers.
A clear explanation of sorting squared values from a sorted array using two pointers.
A clear explanation of maximizing the advantage of one array over another using sorting, greedy matching, and two pointers.
A clear explanation of solving Bag of Tokens using sorting, greedy choices, and two pointers.
A clear explanation of solving DI String Match using a greedy two-pointer construction.
A clear explanation of solving Valid Mountain Array by walking up the increasing slope and then down the decreasing slope.
A two-pass solution for computing the shortest distance from each index to the nearest occurrence of a target character.
A two-pointer group comparison solution for counting how many words can be stretched to match a target string.
A clear explanation of counting contiguous subarrays whose maximum value lies inside a given inclusive range.
A clear explanation of validating string transformation using two pointers and movement constraints.
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 restoring a Candy Crush board to a stable state using repeated marking, crushing, and gravity simulation.
A clear explanation of finding the kth smallest pair distance using sorting, binary search on the answer, and a two-pointer count.
A clear explanation of counting contiguous subarrays whose product is less than k using a sliding window.
Check whether a string can become a palindrome after deleting at most one character using two pointers.
A clear explanation of finding the k closest elements to a target using binary search and a sliding window.
A center expansion solution for counting every palindromic substring in a string.
A two-pointer and number theory solution for checking whether an integer can be written as the sum of two square numbers.
A two-pointer guide for counting triplets that can form valid triangles after sorting the side lengths.
A clear explanation of checking whether a singly linked list is a palindrome using fast and slow pointers plus in-place reversal.
A clear explanation of summarizing a sorted unique integer array into compact consecutive ranges.
A clear explanation of the Trapping Rain Water problem using left and right boundaries, then an optimized two-pointer solution.
A clear linear-time solution for finding the shortest subarray that must be sorted to make the whole array sorted.
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 reversing the first k characters in every 2k block of a string.
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 longest run of 1s after flipping at most one 0 using a sliding window.
A clear explanation of constructing the magical string by using the string itself as run-length instructions.
A clear explanation of finding the minimum heater radius by sorting positions and matching each house to its nearest heater.
A clear explanation of detecting a valid cycle in a circular array using fast and slow pointers.
A clear explanation of the greedy two-pointer solution for maximizing the number of content children.
Compress a character array in-place using two pointers and grouped character counting.
A clear explanation of finding the longest substring that can become all one letter using a sliding window.
A clear explanation of adding two non-negative integer strings using manual digit-by-digit simulation.
A clear explanation of validating a word abbreviation using two pointers and number parsing.
A clear explanation of checking whether one string is a subsequence of another using two pointers.
A clear explanation of sorting values after applying a quadratic function using two pointers.
A clear explanation of Intersection of Two Arrays II using frequency counting.
A clear explanation of Intersection of Two Arrays using hash sets for uniqueness and fast lookup.
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 Odd Even Linked List using in-place pointer rewiring.
A clear explanation of Create Maximum Number using monotonic stacks for subsequences and greedy merging.
A Floyd cycle detection solution for finding the repeated number without modifying the array and using constant extra space.
A two-pointer in-place solution for moving all zeroes to the end while preserving the relative order of non-zero elements.
A two-pass solution for finding a celebrity using the knows API with O(n) calls and O(1) extra space.
A clear explanation of the 3Sum Smaller problem using sorting and the two-pointer technique.
A clear explanation of the Flatten 2D Vector problem using row and column pointers to implement an iterator.
A clear explanation of finding the shortest contiguous subarray whose sum is at least target using a sliding window.
A detailed guide to solving Merge Sorted Array in-place by merging from the back with three pointers.
A detailed guide to solving Partition List with two dummy lists while preserving relative order.
A detailed guide to solving Remove Duplicates from Sorted List II with a dummy node and pointer rewiring.
A detailed guide to solving Remove Duplicates from Sorted Array II with an in-place two-pointer method.
A clear explanation of rotating an array to the right by k steps using in-place reversal.
A clear explanation of reversing the order of words in a character array in-place using two reversals.
A clear explanation of finding two numbers in a sorted array using two pointers and constant extra space.
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 node where two singly linked lists intersect using two pointers.
A clear explanation of reversing word order while removing extra spaces.
Sort a singly linked list in ascending order using merge sort with fast and slow pointers.
Reorder a singly linked list in-place by finding the middle, reversing the second half, and merging the two halves alternately.
Find the node where a linked list cycle begins using Floyd’s tortoise and hare algorithm with cycle entry mathematics.
Detect whether a linked list contains a cycle using Floyd’s tortoise and hare two-pointer algorithm.
A clear explanation of checking whether a string is a palindrome after ignoring non-alphanumeric characters and case.
A clear explanation of converting a sorted linked list into a height-balanced binary search tree using slow and fast pointers.
A clear guide to sorting an array of 0s, 1s, and 2s in place using the Dutch National Flag algorithm.
A clear guide to rotating a linked list to the right by k places using a circular list.
A clear guide to solving Length of Last Word by scanning the string from right to left.
A clear explanation of finding the next lexicographically greater permutation in place using a right-to-left scan.
A clear explanation of finding the first occurrence of one string inside another using direct string matching.
A clear explanation of removing all occurrences of a value from an array in place using a write pointer.
A clear explanation of removing duplicates from a sorted array in place using two pointers.
A detailed explanation of removing the nth node from the end of a singly linked list using two pointers and a dummy node.
A detailed explanation of finding all unique quadruplets that sum to a target using sorting and two pointers.
A detailed explanation of finding the sum of three integers closest to a target using sorting and two pointers.
A detailed explanation of finding all unique triplets that sum to zero using sorting and two pointers.
A detailed explanation of finding the maximum water container area using two pointers.
A detailed explanation of finding the longest palindromic substring using expand-around-center.
Find the k-th smallest absolute difference among all pairs in an array.