↓Skip to main content

LeetCode

LeetCode 3545: Minimum Deletions for At Most K Distinct Characters
·1 min
LeetCode Easy Greedy Hash-Table String Sorting Counting
LeetCode 3545 note: reducing the number of kinds means deleting whole kinds, starting from the least frequent
LeetCode 1550: Three Consecutive Odds
·1 min
LeetCode Easy Array
LeetCode Problem Solving
LeetCode 990: Satisfiability of Equality Equations
·1 min
LeetCode Daily Medium Union-Find
LeetCode Problem Solving
LeetCode 952: Largest Component Size by Common Factor
·2 mins
LeetCode Hard Math Number-Theory Union-Find Hash-Table Array
LeetCode 952 note: sharing a factor ⇔ sharing a prime factor; factor each number and union indices with the same prime factor using Union-Find, with no pairwise GCDs
LeetCode 947: Most Stones Removed with Same Row or Column
·3 mins
LeetCode Medium Union-Find
LeetCode Problem Solving
LeetCode 3541: Find Most Frequent Vowel and Consonant
·1 min
LeetCode Easy Hash-Table String Counting
LeetCode 3541 note: count characters, take the maximum among vowels and among consonants and add them; a missing class counts as 0
LeetCode 200: Number of Islands
·1 min
LeetCode Medium Dfs
LeetCode Problem Solving
LeetCode 1920: Build Array from Permutation
·1 min
LeetCode Easy Array Simulation
LeetCode 1920 note: follow the definition ans[i] = nums[nums[i]]; for O(1) extra space, stack the new value times n on top of the old one
LeetCode 1319: Number of Operations to Make Network Connected
·2 mins
LeetCode Medium Union-Find
LeetCode Problem Solving
LeetCode 1202: Smallest String With Swaps
·1 min
LeetCode Medium Union-Find
LeetCode Problem Solving
LeetCode 684: Redundant Connection
·1 min
LeetCode Daily Medium Union-Find
LeetCode Problem Solving
LeetCode 547: Number of Provinces
·3 mins
LeetCode Medium Union-Find Dfs
LeetCode Problem Solving