SOLVE

LATER

XOR of Subarray

Problem

Editorial

Analytics

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} \)

Explanation

Cost in shops 1 and 2 : 1 XOR 2 = 3

Cost in shops 2 and 3 : 2 XOR 3 = 1

Since cost from shop 1 to 2 is more than those in shop 2 to 3, Milly should start shopping from shop number 2 itself.

Time Limit:
1.0 sec(s)
for each input file.

Memory Limit:
256 MB

Source Limit:
1024 KB

Marking Scheme:
Marks are awarded when all the testcases pass.

Allowed Languages:
C,
C++,
C++14,
Clojure,
C#,
D,
Erlang,
F#,
Go,
Groovy,
Haskell,
Java,
Java 8,
JavaScript(Rhino),
JavaScript(Node.js),
Julia,
Kotlin,
Lisp,
Lisp (SBCL),
Lua,
Objective-C,
OCaml,
Octave,
Pascal,
Perl,
PHP,
Python,
Python 3,
R(RScript),
Racket,
Ruby,
Rust,
Scala,
Swift,
Swift-4.1,
Visual Basic

Initializing Code Editor...

Challenge Name

Euromonitor International Hiring Challenge

Euromonitor International Hiring Challenge

OTHER PROBLEMS OF THIS CHALLENGE

{"1abdc3a": "/pagelets/show-submission/algorithm/xor-of-subarray/", "a160226": "/pagelets/problems-hint/algorithm/xor-of-subarray/", "0ba5674": "/pagelets/recommended-problems/algorithm/xor-of-subarray/", "951a16e": "/pagelets/suggested-problems/algorithm/xor-of-subarray/", "8a455b5": "/pagelets/problem-author-tester/algorithm/xor-of-subarray/"}

realtime.hackerearth.com

80

94721027bc5abfabd7e424c66bc8547db5b49dd7

58a29e5cae2309f04b28

/realtime/pusher/auth/