Search⌘ K
AI Features

Solution: Longest Nice Subarray

C# solution for the Longest Nice Subarray problem using the Sliding Window pattern.

Statement

Given an integer array nums, a subarray is called nice if for every pair of distinct indices i and j within that subarray, the bitwise AND of the corresponding values is equal to 00, meaning `nums[i] & nums[j] == 0$.

Return the maximum possible length of a nice subarray of nums.

Constraints:

  • 11 \leq nums.length ...