Divisible subarrays problem (hackerblocks)


this is my code please have a glance over it and tell why the code is giving me the wrong output.
I am so close to solution i guess.