原文:[LeetCode] 421. Maximum XOR of Two Numbers in an Array 數組中異或值最大的兩個數字

Given anon emptyarray of numbers, a , a , a , , an , where ai lt . Find the maximum result of aiXOR aj, where i,j lt n. Could you do this in O n runtime Example: 這道題是一道典型的位操作 Bit Manipulation 的題目,我開始 ...

2016-10-23 23:57 5 13857 推薦指數:

查看詳情

LeetCode421. Maximum XOR of Two Numbers in an Array

  這道題的題目很好理解,就是給你一個非空數組,求出數組任意兩個數或后能得到的最大值。原題鏈接:LeetCode421 。根據題目下面的tag的提示,本題的解題思路是Trie樹的利用和整數的位操作。   這里Trie樹建立的思路是,整數在存儲時是一個占據32bit的數,因此可以看成一個含32 ...

Thu Feb 16 04:33:00 CST 2017 0 1461
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM