 All Problems
Longest Nice Subarray
medium
arrays
sliding window
bit manipulation
amazon
google

Given an array of positive integers nums, a subarray is "nice" if the bitwise AND of every pair of elements in different positions is 0. Return the length of the longest nice subarray.

Example 1:

Input: 1 3 8 48 10
Output: 3

Example 2:

Input: 3 1 5 11 13
Output: 1

Input format: Space-separated positive integers.

Output format: Length of longest nice subarray.

Run to check your code against the sample cases, or submit to run every case