Subarray with XOR less than k

Revision en2, by wish_me, 2017-08-10 19:09:44

I need help in this problem.Can any one explain.Thanks in advance.

Given an array of n numbers and a number k. You have to write a program to find the number of subarrays with xor less than k.

Examples:

Input: arr[] = {8, 9, 10, 11, 12}, k=3 Output: 4 Sub-arrays [1:3], [2:3], [2:5], [4:5] have xor values 2, 1, 0, 1 respectively.

Input: arr[] = {12, 4, 6, 8, 21}, k=8 Output: 4

Tags trie, array, xor

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English wish_me 2017-08-10 19:09:44 70
en1 English wish_me 2017-08-10 19:09:04 357 Initial revision (published)