LeetCode
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 1826: Faulty Sensor
·2 mins
LeetCode
Easy
Two-Pointers
Array
LeetCode 1826 note: at the first mismatch, test both “who dropped a value” explanations; if both fit, it cannot be determined, so return -1
LeetCode 3885: Design Event Manager
·2 mins
LeetCode
Medium
Heap
Design
Hash-Map
Lazy-Deletion
LeetCode 3885 note: a dict of current priorities plus a max-heap with lazy deletion, validated on pop
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 3843: First Element with Unique Frequency
·1 min
LeetCode
Medium
Hash-Table
Counting
Array
LeetCode 3843 note: count each value, then count how many values share each count; the first element from the left whose count is its own is the answer
LeetCode 3842: Toggle Light Bulbs
·1 min
LeetCode
Easy
Hash-Table
Simulation
Array
LeetCode 3842 note: toggle membership in a set, or keep bulbs appearing an odd number of times, then sort
LeetCode 3840: House Robber V
·2 mins
LeetCode
Medium
Dynamic-Programming
Array
LeetCode 3840 note: houses conflict only when adjacent with the same color; take a house outright when the colors differ, and do the House Robber choice only when they match
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 3719: Longest Balanced Subarray I
·2 mins
LeetCode
Medium
Hash-Table
Prefix-Sum
Segment-Tree
Array
LeetCode 3719 note: n is only 1500, so fix the left end and extend right, maintaining distinct odds and evens in two sets
LeetCode 2838: Maximum Coins Heroes Can Collect
·2 mins
LeetCode
Medium
Binary-Search
Prefix-Sum
Sorting
LeetCode 2838 note: sort monsters by power, build coin prefix sums, and bisect_right per hero