Java | 3 liner | Explained
Idea: Iterate over the array, form the new number and check for divisibility by 5. Mod by 5 at every iteration to avoid overflows\n>T/S: O(n)/O(1), where n = si
**Idea:** Iterate over the array, form the new number and check for divisibility by 5. Mod by 5 at every iteration to avoid overflows\n>**T/S:** O(n)/O(1), where n = size(nums). Ignoring space for output\n```\npublic List<Boolean> prefixesDivBy5(int[] nums) {\n\tvar answer = new ArrayList<Boolean>(nums.length);\n\tfor (int i = 0, n = 0; i < nums.length; i++) \n\t\tanswer.add((n = (n << 1 | nums[i]) % 5) == 0);\n\treturn answer;\n}\n```\n***Please upvote if this helps***
['Java']