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
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
Physics,
2 months ago
Biology,
2 months ago
Computer Science,
2 months ago
Science,
4 months ago
Computer Science,
4 months ago
Geography,
10 months ago