Search
⌘K

Leetcode 2401. Longest Nice Subarray

Find the maximum length of a contiguous subarray in which the bitwise AND of every pair of distinct elements is 0 — equivalently, no two numbers in the subarray share a common 1-bit. This is typically solved by maintaining a sliding window and ensuring the combined bitmask has no overlapping set bits (n ≤ 1e5, nums[i] ≤ 1e9).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.