Leetcode 2871
IntuitionUse Arraylist to store the subarray, once the AND value becomes 0, clear it and use recursion to check for another subarray.ApproachComplexity

Time co
# Intuition
Use Arraylist to store the subarray, once the AND value becomes 0, clear it and use recursion to check for another subarray. 

# Approach
 

# Complexity
- Time complexity:


- Space complexity:
 

# Code
```java []
class Solution {
    public int maxSubarrays(int[] nums) {

        ArrayList<Integer> check = new ArrayList<>();
        int count=0; int sum=0;
        return rec(nums,0,check,count);
    }
      
    private int rec(int[] nums, int ind, List<Integer> a, int count){
      
   
     if(ind< nums.length){
          
      a.add(nums[ind]);
     
     
       if(minsum(a)==0){
        count++; a.clear();
       return rec(nums, ind+1, a, count);
       }
       else{
        a.add(nums[ind]);
        return rec(nums, ind+1, a, count);
       }
     
     }
     
    return count==0?1:count;
    }

    private int minsum(List<Integer> a){
        int cursum = -1;
        for(int x:a){
           cursum = cursum & x; 
        }
        return cursum;
    }
}
    
```
['Recursion', 'Java']