2871. Split Array Into Maximum Number of Subarrays
You are given an array
nums
consisting of non-negative integers.We define the score of subarray
nums[l..r]
such thatl <= r
asnums[l] AND nums[l + 1] AND ... AND nums[r]
where AND is the bitwiseAND
operation.Consider splitting the array into one or more subarrays such that the following conditions are satisfied:
- E**ach element of the array belongs to exactly** one subarray.
- The sum of scores of the subarrays is the minimum possible.
Return the maximum number of subarrays in a split that satisfies the conditions above.
A subarray is a contiguous part of an array.
1 | class Solution { |