Search⌘ K
AI Features

Solution: Longest Nice Subarray

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

We'll cover the following...

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 two values is equal to 00, meaning nums[i] & nums[j] == 0.

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

Note: A subarray is a contiguous segment of nums.

Constraints:

  • 11 \leq ...