[Java] 2ms, 100% + math theory
\nclass Solution {\n    /** Algorithm/Theory\n        1. In order to determine if a binary is divisible by 5, we have to build the 10 base & check\n        2. A
```\nclass Solution {\n    /** Algorithm/Theory\n        1. In order to determine if a binary is divisible by 5, we have to build the 10 base & check\n        2. As the problem states, there will be a stream of bits, 1 and 0 that will build n numbers\n           In order to build the next number, start with a value of 0, multiply the current value with 2 and and 0 or 1 (depending on current bit)\n           EG: 1100\n           step1: value = 0. 0 * 2 + 1 = 1; \n           step2: value = 1. 1 * 2 + 1 = 3;\n           step3: value = 3. 3 * 2 + 0 = 6;\n           step4: value = 6. 6 * 2 + 0 = 12.\n        3. Looking at the steps on #2, we can see that no number (1,3,6,12) is divibile by 5\n        4. What if the stream is much longer, like 33,34 bits? The numbers will become 4 bil +\n           We need to find a smart approach for this.\n        5. We don\'t really need the whole number, but just it\'s modulo 10.\n           EG: value = 6 and the stream continues with [1,1,1,1]\n            - 6 * 2 + 1 = 13   => modulo 10 = 3\n              13 * 2 + 1 = 27  => 3 * 2 + 1 = 7\n              27 * 2 + 1 = 55  => 7 * 2 + 1 = 15 mod 10 = 5.\n        6. Thus we observe that the numbers will always be between 0 and 9.\n           If current value is 0 or 5, then it divides, if !=, then it doesn\'t divide.\n    */\n    public List<Boolean> prefixesDivBy5(int[] nums) {\n        List<Boolean> divisibleByFive = new ArrayList<>(nums.length);\n        int n = 0;\n        for(int bit : nums) {\n            n = (n * 2 + bit) % 10;\n            divisibleByFive.add(n == 5 || n == 0);\n        }\n        return divisibleByFive;\n    }\n}\n```
['Java']