Given an array of non negative integers Find the longest continuous sub array which it's sum is divisible by 5.
For example if the array is: [1,3,9,2,1,5,0,1]
A continuous subarray which it's sum is divisible by 5 for example is: [3,9,2,1]
The longest one will be: [3,9,2,1,5, 0]
So the output will be 6.
It is obvious that a simple algorithm for this will be to just run over all the continuous subarrays and check the one with the biggest size but it will be $O(n^2)$. Is there an algorithm in $O(n)$ time which will solve this one?