美文网首页
421. Maximum XOR of Two Numbers

421. Maximum XOR of Two Numbers

作者: 我是你的果果呀 | 来源:发表于2016-12-19 05:52 被阅读0次

    Given anon-emptyarray of numbers, a0, a1, a2, … , an-1, where 0 ≤ ai< 231.

    Find the maximum result of aiXOR aj, where 0 ≤i,j<n.

    Could you do this in O(n) runtime?

    Example:

    Input:[3, 10, 5, 25, 2, 8]Output:28Explanation:The maximum result is5^25= 28.

    利用字典树,

    相关文章

      网友评论

          本文标题:421. Maximum XOR of Two Numbers

          本文链接:https://www.haomeiwen.com/subject/ncnzmttx.html