Rippling Interview Question

Binary lifting problem to find kth ancestor Connected graph problem