LeetCode 128 - Longest Consecutive Sequence
From O(n log n) sorting to an O(n) hash set solution — finding the longest consecutive sequence by identifying sequence heads.
From O(n log n) sorting to an O(n) hash set solution — finding the longest consecutive sequence by identifying sequence heads.
Validate a 9×9 Sudoku board by checking rows, columns, and 3×3 sub-boxes — from brute-force to a clean one-pass hash set solution.
Learning Vietnamese through Frieren Beyond Journey's End Chapter 82 — Sino-Vietnamese vocabulary, colloquial phrases, and grammar notes.
Calculate the product of all elements except self without division — using prefix and suffix products to achieve O(n) time.
Design a serialization protocol to encode a list of strings into a single string and decode it back — a problem rooted in real network communication design.
Find the k most frequent elements — from brute force to an optimal O(n) bucket sort solution.
Group strings that are anagrams of each other — from brute-force sorting to an optimal character-count hash map.
Find two indices that sum to a target — from brute force to one-pass hash table, three solutions compared.
Detect duplicates in an array using a Set — two solutions compared by time and space complexity.
Use a hash map to check whether two strings are anagrams of each other in O(N) time.