Leetcode: Longest Nice Subarray
A bitmask problem
You are given an array
nums consisting of positive integers.
We call a subarray of
nums nice if the bitwise AND of every pair of elements that are in different positions in the subarray is equal to
Return the length of the longest nice subarray.
A subarray is a contiguous part of an array.
Note that subarrays of length
1 are always considered nice.
Input: nums = [1,3,8,48,10]…