Here is two implementation of this problem
Using Sparse Table: Submission Using Segment Tree: Submission
Time took by Sparse Table is 0.336 ,where Segment Tree took 0.324 s Memory took by Sparse Table is 8732 KB ,where Segment Tree tokk 3640 KB
Problem is statis,thats why Sparse Table should be fast!But here i couldn't see this..Where is the problem?Could anyone please find that out ?
Thanks in advance :)