EASY SOLUTION IN JAVA BEATING 98.16% IN 3ms 
IntuitionThe problem asks us to determine whether the number represented by the binary subarray nums[0..i] (where i ranges from 0 to n-1) is divisible by 5. The
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
The problem asks us to determine whether the number represented by the binary subarray nums[0..i] (where i ranges from 0 to n-1) is divisible by 5. The binary number formed from nums[0..i] is built progressively as we move through the array.
# Approach
<!-- Describe your approach to solving the problem. -->
1. **Initialization:** Start with num = 0. This will represent the binary number at the current index modulo 5.
2. **Progressively Build the Binary Number:**  For each bit in nums:
    - Shift the previous number left (multiply by 2).
    - Add the current bit.
    - Take modulo 5 to keep the result within a manageable range.
3. **Check Divisibility:** For each new num, check if it is divisible by 5. If it is, append true to the result list; otherwise, append false.
4. **Return Result:** Once the entire array has been processed, return the list of boolean values.
# Complexity
- Time complexity: O(n)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: O(n)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

![image.png](https://assets.leetcode.com/users/images/aff4a641-0f93-4d6b-baff-643801fa2283_1738565218.1554568.png)

# Code
```java []
class Solution {
    public List<Boolean> prefixesDivBy5(int[] nums) {
        List<Boolean> result = new ArrayList<>();
        int num = 0;
        
        for (int i = 0; i < nums.length; i++) {
            num = (num * 2 + nums[i]) % 5; // Build the number modulo 5
            result.add(num == 0); // Check if divisible by 5
        }
        
        return result;
    }
}

```
['Array', 'Bit Manipulation', 'Java']