diff --git a/algorithms/CPlusPlus/Trie/Max-Xor-of-Two-Number-Trie.cpp b/algorithms/CPlusPlus/Trie/Max-Xor-of-Two-Number-Trie.cpp index cb88b51b..f7128e6b 100644 --- a/algorithms/CPlusPlus/Trie/Max-Xor-of-Two-Number-Trie.cpp +++ b/algorithms/CPlusPlus/Trie/Max-Xor-of-Two-Number-Trie.cpp @@ -1,3 +1,10 @@ +/** + * +one of the standard Brute force is O(n^2),but this is optimized version of this question +time complexity of inserting all element in Trie of array is O(31*n). +time complexity of finding Xor of each element in Trie of given array is O(31*n). +so the complexity is O(31*n); + */ #include using namespace std; #define ll long long int @@ -142,4 +149,10 @@ int main() mx = max(mx, res ^ i); } cout << mx; -} \ No newline at end of file +} +/** +sample input +a = [1,2,3] +output +3 (i.e. (2^1)) +*/ \ No newline at end of file