Skip to content
← Back to all lessons

TodayILearned

Algorithms lessons

One fullstack engineering concept every day — taught deeply, then compressed into a public post.

Day 004 · June 28, 2026

Contains Duplicate — the hash set pattern

When 'have I seen this before?' is the question, a hash set is the answer.

Algorithms
Day 005 · June 28, 2026

Valid Anagram — the frequency count pattern

When the question is 'how many times?', a hash map is the answer.

Algorithms
Day 011 · July 5, 2026

Two Sum — hash map complement lookup

The #1 most-asked LeetCode problem. One pass, one hash map, one key insight: for each number, check if you've already seen its complement.

Algorithms
Day 012 · July 6, 2026

Group anagrams — sort key vs count key

Two ways to build a canonical key: sort each string (O(n × k log k)) or count characters (O(n × k)). The benchmark reveals a surprising crossover.

Algorithms
Day 018 · July 13, 2026

Top K Frequent Elements — Heap vs Bucket Sort

Day 5 counted frequencies. Day 12 grouped by frequency. Today: find the top K. Three approaches, three Big O complexities — and a benchmark that shows the textbook O(n) answer isn't always the fastest in practice.

Algorithms
Day 019 · July 13, 2026

Product of array except self — prefix × suffix

The no-division constraint forces a reframe: the answer for each position is the product of everything before it × everything after it. Two passes, O(n) time, O(1) space.

Algorithms