[1]: https://www.geeksforgeeks.org/lca-for-general-or-n-ary-trees-sparse-matrix-dp-approach-onlogn-ologn/
for (int i=0; i<level; i++)
if ((diff>>i)&1)
v = parent[v][i];
In the above code, it only jumps to the 2^ith parent, when "(diff>>i)" is odd. Why is it so? How did we understand that only in case of odd "(diff>>i)", we have to jump?
First of all, this answer doesn't explain the snippet you shared.
I really didn't understand that part of code either. I am not sure the code there is buggy or not because this seems incorrect. I can share my function on that part, hopefully you might find it a bit easier to understand. I put some comment to ease your understanding.