Pls suggest how to solve this https://www.hackerrank.com/challenges/maximizing-the-function/problem

the link is https://www.hackerrank.com/challenges/maximizing-the-function/problem

Hi!
In this problem the goal is to mind maximum possible value of function g, where g is nothing but sum of f(i,j).
Now f(i,j) is XOR of sun-array Ai…Aj : now this XOR can either be 0 or 1, it can be 1 only when the number of 1’s are odd,
for example: 1^0^1^0 =0, and 1^1^0^1^0=1, therefore function g will be yield the number of subarrays with odd number of 1’s, you can loop this logic to get the result.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.