You are viewing a single comment's thread. Return to all comments →
def anotherMinimaxProblem(a): if all(x == 0 for x in a): return 0 n = len(a) max_bit = max(a).bit_length() for bit in range(max_bit - 1, -1, -1): ones, zeros = [], [] for num in a: if num & (1 << bit): ones.append(num) else: zeros.append(num) if zeros and ones: break if not zeros or not ones: return min(a[i] ^ a[j] for i in range(n) for j in range(i + 1, n)) return min(x ^ y for x in zeros for y in ones)
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 →