I was trying to learn Mo's Algorithm from here and this was one of the suggested problems. But, I'm getting TLE verdict with Java, while my code is very similar to the one that the tutorial's author has written, in C++.
Can someone please tell me what am I doing wrong(slow)? Thanks.
UPDATE : Sorry, forgot to post a link for my code