Easy
LeetCode 69: Sqrt(x)
·1 min
LeetCode
Easy
Math
Binary-Search
Newtons-Method
LeetCode 69 note: find the largest mid with mid² <= x; when a closed-interval search ends, r is the answer
LeetCode 67: Add Binary
·2 mins
LeetCode
Easy
Math
String
Bit-Manipulation
Simulation
LeetCode 67 note: add from the ends of both strings digit by digit, with carry sum // 2 and digit sum % 2
LeetCode 66: Plus One
·2 mins
LeetCode
Easy
Array
Math
LeetCode 66 note: add one from the last digit, turning 9s into 0s while carrying, and prepend 1 when every digit was 9
LeetCode 58: Length of Last Word
·1 min
LeetCode
Easy
String
LeetCode 58 note: split() with no argument ignores trailing spaces; return the length of the last word
LeetCode 35: Search Insert Position
·2 mins
LeetCode
Easy
Array
Binary-Search
LeetCode 35 note: find the first position >= target (lower bound); a half-open [l, r) needs r = mid, not r = mid - 1
LeetCode 28: Find the Index of the First Occurrence in a String
·1 min
LeetCode
Easy
Two-Pointers
String
String-Matching
Z-Algorithm
LeetCode 28 note: try matching needle at every start, or use str.find; index raises when not found
LeetCode 27: Remove Element
·1 min
LeetCode
Easy
Array
Two-Pointers
LeetCode 27 note: the write pointer copies only values not equal to val, returning how many were written
LeetCode 620: Not Boring Movies
·1 min
LeetCode
Easy
Database
LeetCode 620 note: odd id and description not ‘boring’, ordered by rating from high to low
LeetCode 596: Classes With at Least 5 Students
·1 min
LeetCode
Easy
Database
LeetCode 596 note: group by class with HAVING COUNT(DISTINCT student) >= 5; older test data had duplicate rows, so count distinct students
LeetCode 595: Big Countries
·1 min
LeetCode
Easy
Database
LeetCode 595 note: filter with WHERE and OR for an area of at least 3 million or a population of at least 25 million
LeetCode 197: Rising Temperature
·1 min
LeetCode
Easy
Database
LeetCode 197 note: self-join Weather on a one-day date difference with today warmer; compare dates with DATEDIFF, never ids
LeetCode 196: Delete Duplicate Emails
·2 mins
LeetCode
Easy
Database
LeetCode 196 note: it must be a DELETE, not a SELECT; keep only the smallest id per email and delete the rest