I was trying a sparse table problem in spoj called Miraculous. The link is: https://www.spoj.com/problems/TNVFC1M/
I was thinking to solve the problem using sparse table . But did not find an idea. So, can anyone help me to solve it or share the main idea of the problem?? Thanks in advance.