Notebook
All posts
Tags
Archive
About
☀
☾
Archive
3 posts · 1 year
CodeChef
1
DSA
2
2026
CodeChef
DSA
GCDARR2. GCD Arrays (Hard)
Problems
·
Jun 19, 2026
·
12 min read
CodeChef / Problems
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
Euler Tour on Trees
Trees
·
Jun 18, 2026
·
6 min read
DSA / Trees
Flatten a tree into an array using DFS timestamps — subtree queries become range queries, and you can throw a segment tree at them.
LCA and Binary Lifting
Trees
·
Jun 12, 2026
·
8 min read
DSA / Trees
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.