↓Skip to main content

Easy

LeetCode 2540: Minimum Common Value
·2 mins
LeetCode Easy Two-Pointers Array
LeetCode 2540 note: one pointer per sorted array, advance the smaller side, and the first match is the answer
LeetCode 976: Largest Perimeter Triangle
·2 mins
LeetCode Easy Math Greedy Sorting Geometry Array
LeetCode 976 note: after sorting, check consecutive triples from the largest down; the first with a + b > c gives the largest perimeter
LeetCode 3684: Maximize Sum of At Most K Distinct Elements
·1 min
LeetCode Easy Greedy Sorting Hash-Table
LeetCode 3684 note: all values are positive, so deduplicate and take the k largest in descending order
LeetCode 2273: Find Resultant Array After Removing Anagrams
·2 mins
LeetCode Easy Hash-Table String Sorting
LeetCode 2273 note: repeatedly deleting a word that is an anagram of the previous one keeps exactly the words that are not anagrams of the last kept word; compare sorted strings
LeetCode 1984: Minimum Difference Between Highest and Lowest of K Scores
·1 min
LeetCode Easy Sliding-Window Sorting Array
LeetCode 1984 note: after sorting, the chosen k scores are always contiguous; slide a fixed window of length k and subtract its ends
LeetCode 2697: Lexicographically Smallest Palindrome
·2 mins
LeetCode Easy Two-Pointers String Greedy
LeetCode 2697 note: converging pointers, setting both ends to the smaller character whenever they differ
LeetCode 3813: Vowel-Consonant Score
·1 min
LeetCode Easy String Simulation
LeetCode 3813 note: count letters only, split into vowels and consonants; the score is 0 with no consonants, otherwise integer division
LeetCode 3258: Count Substrings That Satisfy K-Constraint I
·2 mins
LeetCode Easy Sliding-Window String
LeetCode 3258 note: valid means zeros <= k or ones <= k; it is invalid only when both exceed k, and after shrinking there are right - left + 1 valid substrings ending at right
LeetCode 1763: Longest Nice Substring
·2 mins
LeetCode Easy Sliding-Window Divide-and-Conquer Hash-Table String Bit-Manipulation
LeetCode 1763 note: a character whose other case never appears cannot be in the answer, so split on it and recurse, preferring the left side on ties
LeetCode 3803: Count Residue Prefixes
·1 min
LeetCode Easy Hash-Table String
LeetCode 3803 note: add characters to a set while scanning; count a prefix when its distinct count equals its length % 3
LeetCode 3090: Maximum Length Substring With Two Occurrences
·1 min
LeetCode Easy Sliding-Window Hash-Table String
LeetCode 3090 note: a longest-window slide that shrinks the left whenever the newly added character appears more than twice
LeetCode 3798: Largest Even Number
·1 min
LeetCode Easy String
LeetCode 3798 note: parity depends only on the last digit, so just delete trailing 1s; keeping more digits is larger