Divisible sub arrays


i am getting the time limit error how to minimize it

I would suggest you to go through the online video lecture given in the course as : https://youtu.be/QQQpOa3aXew
And then make changes in your code accordingly.