Tap here to switch tabs
Problem
Submissions

Problem: Longest Subsequence With Non-Zero Bitwise XOR

Longest Subsequence With Non-Zero Bitwise XOR asks you to choose a subsequence of an integer array with the greatest length whose bitwise XOR is not zero, or return zero if none exists.

Statement

Given an integer array nums, return the maximum length of a subsequence of nums whose bitwise XOR sum is not equal to 00. If no such subsequence exists, return 00.

Note: A subsequence is a sequence that can be derived from an array by deleting zero or more elements without changing the order of the remaining elements.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 0≤0 \leq nums[i] ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Longest Subsequence With Non-Zero Bitwise XOR

Longest Subsequence With Non-Zero Bitwise XOR asks you to choose a subsequence of an integer array with the greatest length whose bitwise XOR is not zero, or return zero if none exists.

Statement

Given an integer array nums, return the maximum length of a subsequence of nums whose bitwise XOR sum is not equal to 00. If no such subsequence exists, return 00.

Note: A subsequence is a sequence that can be derived from an array by deleting zero or more elements without changing the order of the remaining elements.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 0≤0 \leq nums[i] ≤109\leq 10^9