Sparse Matrix DP approach to find LCA of two nodes
#include <bits/stdc++.h> NEW_LINE using namespace std ; #define MAXN  100000 NEW_LINE #define level  18 NEW_LINE vector < int > tree [ MAXN ] ; int depth [ MAXN ] ; int parent [ MAXN ] [ level ] ;