String
LeetCode 3952: Maximum Total Value of Covered Indices
·2 mins
LeetCode
Medium
Dynamic-Programming
State-Machine
Greedy
String
LeetCode 3952 note: each token moves left at most once, so the state is whether this index’s token moved left; moving only helps if the index to the left was not already covered
LeetCode 3931: Check Adjacent Digit Differences
·1 min
LeetCode
Easy
String
LeetCode 3931 note: check that every pair of adjacent digits differs by at most 2
LeetCode 91: Decode Ways
·3 mins
LeetCode
Medium
Dynamic-Programming
String
LeetCode note for Decode Ways, rebuilt from the original learning note
LeetCode 139: Word Break
·2 mins
LeetCode
Medium
Dynamic-Programming
String
LeetCode note for Word Break, rebuilt from the original learning note
LeetCode 3913: Sort Vowels by Frequency
·2 mins
LeetCode
Medium
String
Sorting
Counting
LeetCode 3913 note: extract only the vowels, sort by (-count, first occurrence), and put them back into the vowel positions
LeetCode 3900: Longest Balanced Substring After One Swap
·3 mins
LeetCode
Medium
Prefix-Sum
Hash-Table
String
LeetCode 3900 note: equal prefix differences mean balanced; a substring off by 2 also works if a swappable character exists outside, and keeping the two earliest positions per difference is enough
LeetCode 522: Longest Uncommon Subsequence II
·2 mins
LeetCode
Medium
Two-Pointers
String
Sorting
Array
Hash-Table
LeetCode 522 note: the longest uncommon subsequence is always a whole string; check strings from longest to shortest, and the first that is not a subsequence of any other long-enough string is the answer
LeetCode 3884: First Matching Character From Both Ends
·2 mins
LeetCode
Easy
Two-Pointers
String
LeetCode 3884 note: compare from both ends toward the middle; the first match is the answer, and odd lengths always match in the middle
LeetCode 1023: Camelcase Matching
·2 mins
LeetCode
Medium
Two-Pointers
String
Trie
LeetCode 1023 note: two pointers character by character; anything beyond the pattern must be lowercase
LeetCode 3839: Number of Prefix Connected Groups
·1 min
LeetCode
Medium
Hash-Table
String
Counting
LeetCode 3839 note: words sharing the first k characters are connected, so count by word[:k]; exclude words shorter than k
LeetCode 3838: Weighted Word Mapping
·1 min
LeetCode
Easy
Array
String
Simulation
LeetCode 3838 note: sum each word’s letter weights mod 26 and map backward: 0 -> z, i.e. chr(ord(‘z’) - r)
LeetCode 244: Shortest Word Distance II
·2 mins
LeetCode
Medium
Two-Pointers
Design
Hash-Table
String
Array
LeetCode 244 note: precompute each word’s positions (sorted by construction), then answer each query by merging the two position lists with two pointers, always advancing the smaller one