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.
Here's a slightly more efficient solution in Python3. It uses a lazy-evaluation generator rather than first creating a long list for the maximum; it also avoids needless edge values. Of course, this is neither as efficient nor as clever as the analytical formula discussed earlier.
Maximizing XOR
You are viewing a single comment's thread. Return to all comments →
Here's a slightly more efficient solution in Python3. It uses a lazy-evaluation generator rather than first creating a long list for the maximum; it also avoids needless edge values. Of course, this is neither as efficient nor as clever as the analytical formula discussed earlier.