Java | Modular Arithmetic
\nclass Solution {\n    public List<Boolean> prefixesDivBy5(int[] A) {\n        int n = 0;\n        List<Boolean> answer = new ArrayList<>();\n        \n       
```\nclass Solution {\n    public List<Boolean> prefixesDivBy5(int[] A) {\n        int n = 0;\n        List<Boolean> answer = new ArrayList<>();\n        \n        for(int num : A) {\n            n += num;\n            answer.add(n % 5 == 0);\n            n *= 2;\n            n = n % 5;\n        }\n        \n        return answer;\n    }\n}\n```
[]