You are given an array nums.
You can perform the following operation:
Select any subarray nums[l...r].
Replace every element in that subarray with the bitwise AND of all numbers in that subarray.
Your goal is to make all elements in the array equal.
Return the minimum number of such operations required.
Input: nums = [7, 7, 7, 7]
Output: 0
Explanation:
All elements are already equal.
Input: nums = [8, 4, 2]
Output: 0
Explanation:
After two AND operations on chosen subarrays, all values can be made equal.
Accepted:
Submission: