2419. Longest Subarray With Maximum Bitwise AND
On This Page
class Solution:
def longestSubarray(self, nums: List[int]) -> int:
mx = max(nums)
res = cnt = 0
for v in nums:
if v == mx:
cnt += 1
res = max(res, cnt)
else:
cnt = 0
return res