Writing
Notes on algorithms, data structures and the machinery under backend systems. Tags · Archive · RSS
2026
2026-06-19
GCDARR2. GCD Arrays (Hard) CodeChef fix g as the interior GCD, count interior sequences with Möbius inversion, count valid endpoint pairs with inclusion-exclusion — O(M log M + M log N) per test case
2026-06-18
Euler Tour on Trees DSA Flatten a tree into an array using DFS timestamps — subtree queries become range queries, and you can throw a segment tree at them.
2026-06-12
LCA and Binary Lifting DSA How to jump up a tree in powers of two — kth ancestors, lowest common ancestors, and path distances, all in O(log n) per query.
No posts match.