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.
A brute force solution for pairs works. Identify the highest bit from min(arr) XOR max(arr), then select the smallest values among min(arr[i] XOR arr[j]) with this highest bit set. All tests passed.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Yet Another Minimax Problem
You are viewing a single comment's thread. Return to all comments →
A brute force solution for pairs works. Identify the highest bit from min(arr) XOR max(arr), then select the smallest values among min(arr[i] XOR arr[j]) with this highest bit set. All tests passed.