Longest Subarray With Maximum Bitwise AND
Find max value in array, then longest contiguous subarray of that max value, as other numbers reduce bitwise AND result.
2419. Longest Subarray With Maximum Bitwise AND Difficulty: Medium Topics: Array, Bit Manipulation, Brainteaser You are given an integer array nums of size n. Consider a non-empty subarray from nums that has the maximum possible bitwise AND. In other words, let k be the maximum value of the bitwise AND of any subarray of nums. Then, only subarrays with a bitwise AND equal to k should be considered. Return the length of the longest such subarray. The bitwise AND of an array is the bitwise AND of all the numbers in it. A subarray is a contiguous sequence of elements within an array. Example 1:...
