Subarrays Xor less Than B

Given an array of integers A.Find and return the number of subarrays whose xor values is less than B.

Since the number of subarrays can be very large you are required to
return the number of subarrays whose xor values is less than B modulo (109+7).



Input Format

The argument given is the integer array A and an integer B.

Output Format

return the number of subarrays whose xor values is less than B modulo (10^9+7).

Constraints

1 <= length of the array <= 100000
1 <= A[i] <= 10^5
1 <= B <= 10^6

For Example

Input 1:
    A = [8, 3, 10, 2, 6, 7, 6, 9, 3]
    B = 3
Output 1:
    9

Input 2:
    A = [9, 4, 3, 11]
    B = 7
Output 2:
    3
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving Subarrays Xor less Than B on Interview Code Editor
Sign Up
to access hints and editorial solutions for Subarrays Xor less Than B

Discussion


Loading...
Click here to start solving coding interview questions