Reading material Sparse table Lowest Common Ancestor(Binary lifting) Lowest Common Ancestor(Implementation) DP on trees String Hashing Rabin-Karp string matching