We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Combine map and reduce of the last solution to continuously determine the maximum of the XOR operations. This requires a somewhat clumsy starting value "[0]":
Maximizing XOR
You are viewing a single comment's thread. Return to all comments →
Some Python solutions
Here are some Python solutions that came to my mind.
Straightforward solution
Using a variable to store the maximum XOR operation and a for loop to iterate over all valid permutations:
Using map and reduce
Using map() to apply xor and reduce() to get the max of the XOR results:
Using reduce only
Combine map and reduce of the last solution to continuously determine the maximum of the XOR operations. This requires a somewhat clumsy starting value "[0]":
Using generator expression