Java, simple 3 lines, no modulo
I see lots of solutions using %, which is an expensive operation.  If you have something between 0 and 4, then double it and add 0 or 1, your result is between 
I see lots of solutions using %, which is an expensive operation.  If you have something between 0 and 4, then double it and add 0 or 1, your result is between 0 and 9.  Just subtracting 5 if needed is cheaper/faster than using modulo.\n```\n    public List<Boolean> prefixesDivBy5(int[] A) {\n        List<Boolean> ans = new ArrayList<Boolean>( A.length );\n        for( int i=0,x=0; i<A.length; x-=(x>4)?5:0,ans.add(x==0),i++ ) x+=x+A[i];\n        return ans;\n    }\n```
[]