Easy
LeetCode 824: Goat Latin
·1 min
LeetCode
Easy
String
LeetCode 824 note: split into words and convert each: move a leading consonant to the end, then append ma and i + 1 copies of a
LeetCode 821: Shortest Distance to a Character
·2 mins
LeetCode
Easy
Array
Two-Pointers
String
LeetCode 821 note: one left-to-right pass for the distance to the nearest c on the left, then a right-to-left pass taking the minimum
LeetCode 819: Most Common Word
·2 mins
LeetCode
Easy
Array
Hash-Table
String
Counting
LeetCode 819 note: replace punctuation with spaces, lowercase, split, count, and pick the most frequent word not banned
LeetCode 812: Largest Triangle Area
·2 mins
LeetCode
Easy
Array
Math
Geometry
Polygons
LeetCode 812 note: with at most 50 points, enumerate every triple and take the largest shoelace area
LeetCode 806: Number of Lines To Write String
·2 mins
LeetCode
Easy
Array
String
LeetCode 806 note: simulate writing, wrapping when the next letter would exceed 100; landing exactly on 100 stays on the line
LeetCode 804: Unique Morse Code Words
·1 min
LeetCode
Easy
Array
Hash-Table
String
LeetCode 804 note: translate each word into a Morse string and count the distinct results with a set
LeetCode 796: Rotate String
·2 mins
LeetCode
Easy
String
String-Matching
LeetCode 796 note: goal is a rotation of s exactly when the lengths match and goal occurs in s + s
LeetCode 783: Minimum Distance Between BST Nodes
·2 mins
LeetCode
Easy
Tree
Depth-First-Search
Breadth-First-Search
Binary-Search-Tree
LeetCode 783 note: a BST’s in-order is ascending, so the minimum difference is between in-order neighbors; remember the previous value and compare
LeetCode 771: Jewels and Stones
·1 min
LeetCode
Easy
Hash-Table
String
LeetCode 771 note: put jewels in a set and count how many stones are in it
LeetCode 766: Toeplitz Matrix
·2 mins
LeetCode
Easy
Array
Matrix
LeetCode 766 note: every diagonal is constant exactly when each cell equals its upper-left neighbor
LeetCode 762: Prime Number of Set Bits in Binary Representation
·1 min
LeetCode
Easy
Math
Bit-Manipulation
Primality-Test
LeetCode 762 note: numbers are below 10^6 < 2^20, so the set-bit count is at most 19; check it against a small set of primes
LeetCode 748: Shortest Completing Word
·2 mins
LeetCode
Easy
Array
Hash-Table
String
LeetCode 748 note: count the plate’s letters in lowercase, then find the shortest word covering every count, taking the earliest on ties