GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Friday 24 June 2022

[Solution] The Subarray XOR CodeChef Solution


Given an array A having N elements, a subarray S of A is called good if XOR(S)K, where XOR(S) denotes the bitwise XOR of all the elements of the subarray S.
Find the length of the smallest subarray S which is good. If there is no good subarray, print 1 instead.

Input Format

  • The first line of input contains a single integer T, denoting the number of test cases. The description of the T test cases follows.
  • The first line of each test case contains two space-separated integers N and K - as described in the problem statement.
Solution Click Below:-  👉CLICK HERE👈
👇👇👇👇👇


  • The second line of each test case contains N space-separated integers A1,A2,...,ANAi representing the elements of the array A.

Output Format

For each test case, output in a single line, the length of the shortest subarray which is good. If there

Fitness CodeChef Solution

Complementary Strand in a DNA CodeChef Solution 

Make all equal using Pairs Codechef Solution

Count the ACs CodeChef Solution 

Strong Elements CodeChef Solution

Reversal Sorting CodeChef Solution

AP Grid CodeChef Solution

Gcd and Lcm CodeChef Solution

The Subarray XOR CodeChef Solution

 is no good subarray, print 1.

Constraints

  • 1T2104
  • 1N105
  • 0Ai<230
  • 0K<231
  • Sum of N over all test cases does not exceed 2105.

No comments:

Post a Comment