Computer Science, asked by manikarao2000, 4 months ago

You are given an array A of size N.
In one operation, you can do the following:
• Select a subarray, say L to R.
• Let x be the xor of all the elements of the subarray.
• You can either replace A[L] by X or replace A[R] by X.
You are allowed to perform the above operation as many times as you want.
Find the minimum sum of all the elements of the array you can get.
Since the answer can be large, return it modulo 109+7.
Note: You need to minimize the sum before taking the mod.
Problem Constraints​

Answers

Answered by abhi171043
2

Answer:

one operation, you can do the following:

• Select a subarray, say L to R.

• Let x be the xor of all the elements of the subarray.

• You can either replace A[L] by X or replace A[R] by X.

You are allowed to perform the above operation as many times as you want.

Find the minimum sum of all the elements of the array you can get.

Since the answer can be large, return it modulo 109+7.

Note: You need to minimize the sum before taking the mod.

Problem Constraints

Similar questions