[LeetCode] Maximum XOR of Two Numbers in an Array

Posted Grandyang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[LeetCode] Maximum XOR of Two Numbers in an Array相关的知识,希望对你有一定的参考价值。

 

Given a non-empty array of numbers, a0, a1, a2, … , an-1, where 0 ≤ ai < 231.

Find the maximum result of ai XOR aj, where 0 ≤ ij < n.

Could you do this in O(n) runtime?

Example:

Input: [3, 10, 5, 25, 2, 8]

Output: 28

Explanation: The maximum result is 5 ^ 25 = 28.

 

s

 

以上是关于[LeetCode] Maximum XOR of Two Numbers in an Array的主要内容,如果未能解决你的问题,请参考以下文章

#Leetcode# 53. Maximum Subarray

LeetCode 53. Maximum Subarray

LeetCode -- Maximum Product Subarray

leetcode 53. Maximum Subarray

LeetCode Third Maximum Number

LeetCode Create Maximum Number