Enumeration
LeetCode 2044: Count Number of Maximum Bitwise-OR Subsets
·2 mins
LeetCode
Medium
Backtracking
Bit-Manipulation
Enumeration
LeetCode 2044 note: the maximum OR is the OR of everything; once backtracking reaches it, count the rest as 2^k
LeetCode 2094: Finding 3-Digit Even Numbers
·2 mins
LeetCode
Easy
Hash-Table
Enumeration
Array
LeetCode 2094 note: enumerate the even numbers 100 to 998 instead and check that each digit needed is available; Counter subtraction keeps only positives
LeetCode 204: Count Primes
·2 mins
LeetCode
Medium
Array
Math
Enumeration
Number-Theory
LeetCode 204 note: the sieve of Eratosthenes, crossing out multiples of each prime p starting at p², with the outer loop only up to √n