Medium
LeetCode 851: Loud and Rich
·2 mins
LeetCode
Medium
Graph
Topological-Sort
LeetCode note for Loud and Rich, rebuilt from the original learning note
LeetCode 802: Find Eventual Safe States
·3 mins
LeetCode
Medium
Graph
Topological-Sort
LeetCode note for Find Eventual Safe States, rebuilt from the original learning note
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 3899: Angles of a Triangle
·2 mins
LeetCode
Medium
Math
Geometry
LeetCode 3899 note: check the triangle inequality first, compute the three angles with the law of cosines, and remember to sort them
LeetCode 310: Minimum Height Trees
·3 mins
LeetCode
Medium
Graph
Topological-Sort
LeetCode note for Minimum Height Trees, rebuilt from the original learning note
LeetCode 2115: Find All Possible Recipes from Given Supplies
·3 mins
LeetCode
Medium
Graph
Topological-Sort
LeetCode note for Find All Possible Recipes from Given Supplies, rebuilt from the original learning note
LeetCode 2192: All Ancestors of a Node in a DAG
·3 mins
LeetCode
Medium
Graph
Topological-Sort
LeetCode note for All Ancestors of a Node in a DAG, rebuilt from the original learning note
LeetCode 210: Course Schedule II
·2 mins
LeetCode
Medium
Graph
Topological-Sort
LeetCode note for Course Schedule II, rebuilt from the original learning note
LeetCode 207: Course Schedule
·2 mins
LeetCode
Medium
Graph
Topological-Sort
LeetCode note for Course Schedule, rebuilt from the original learning note
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 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 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