You are viewing a single comment's thread. Return to all comments →
My Python Solution
def andXorOr(a): stack = [a[0], a[1]] S = a[0] ^ a[1] for i in range(2, len(a)): while len(stack) > 0 and stack[-1] >= a[i]: S = max(S, stack[-1] ^ a[i]) stack.pop() if len(stack) > 0: S = max(S, stack[-1] ^ a[i]) stack.append(a[i]) return S
Seems like cookies are disabled on this browser, please enable them to open this website
AND xor OR
You are viewing a single comment's thread. Return to all comments →
My Python Solution