XOR of Subarray
Practice
4 (2 votes)
Ad Hoc
Ready
Algorithms
Approved
Easy Medium
Problem
37% Success 2669 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Given an array of N elements , You need to find subarray of size Z , XOR of whose elements is minimum.If multiple such subarrays exist,Choose the subarray whose starting Index is Maximum. Print the start Index of that subarray.

Input Format:
First line of the input will have T (number of test cases). Then for each test case first line will have two integers N and Z. The second line will have a list of N space separated integers denoting the Array values (Array is denoted by A).

Output Format: For each test case, output a single integer denoting starting Index of Subarray.

Input Constraints:

\(1 \le T \le100 \)
\(1 \le Z \le N \le10^4\)
\(1 \le A_i \le10^{12} \)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
57 votes
Tags:
ReadyMathematicsOpenApprovedEasy-MediumMathamatics
Points:20
33 votes
Tags:
ApprovedBasic ProgrammingEasyImplementationOpenString Manipulation
Points:30
7 votes
Tags:
MathematicsDynamic ProgrammingEasy-Medium