JAVA Solution with a Trick to prevent Overflow
\npublic List<Boolean> prefixesDivBy5(int[] A) {\n\tint currentNum = 0;\n\tList<Boolean> sol = new ArrayList<>();\n\tfor(int a : A) {\n\t\t// (a * b + c) % d = 
```\npublic List<Boolean> prefixesDivBy5(int[] A) {\n\tint currentNum = 0;\n\tList<Boolean> sol = new ArrayList<>();\n\tfor(int a : A) {\n\t\t// (a * b + c) % d = ((a % d) * (b % d) + c % d) % d\n\t\tcurrentNum = (currentNum << 1 | a)%5;\n\t\tsol.add(currentNum==0);\n\t}\n\treturn sol;\n}\n```
[]