← All problemsSign in

3702. Longest Subsequence With Non-Zero Bitwise XOR

LeetCodeArrayBit ManipulationOpen on judge ↗

You are given an integer array nums. Return the length of the longest subsequence in nums whose bitwise XOR is non-zero. If no such subsequence exists, return 0. Example 1: Input: nums = [1,2,3] Output: 2 Explanation: One longest subsequence is [2, 3]. The bitwise XOR is computed as 2 XOR 3 = 1, which is non-zero. Example 2: Input: nums = [2,3,4] Output: 3 Explanation: The longest sub

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start