Count Subarrays With XOR K

Given an array nums of non-negative integers and a non-negative integer k, return the number of non-empty contiguous subarrays whose bitwise XOR equals k.

Given an array `nums` of non-negative integers and a non-negative integer `k`, return the number of non-empty contiguous subarrays whose bitwise XOR equals `k`.

- `1 <= nums.length <= 2 * 10^4` - `0 <= nums[i] <= 1000` - `0 <= k <= 1000`

Example 1: input nums = [4,2,2,6,4], k = 6; output 4. Four contiguous ranges have XOR 6.

Example 2: input nums = [5,6,7,8,9], k = 5; output 2. The ranges [5] and [5,6,7,8,9] have XOR 5.

Category: Arrays & Hashing. Topic: arrays. Difficulty: Medium. Patterns: bit-manipulation, hashing, prefix-sum.