Sparse-table

1 articles

dsa6 min read

Kth Ancestor of a Tree Node — LC 1483 Binary Lifting

LC 1483 Kth Ancestor of a Tree Node answers each query in O(log k) after O(n log n) preprocessing using binary lifting — a sparse table DP technique that also powers LCA algorithms and is commonly tested at Amazon.

Read →