DSC-Banasthali-Vidyapith / Code-Crossroad

This project contains the carefully compiled Data Structures & Algorithm questions asked by the companies that visit Banasthali Vidyapith on-campus.
MIT License
55 stars 78 forks source link

Maximum XOR of two numbers in an array #91

Closed Sargam-Agarwal closed 2 years ago

Sargam-Agarwal commented 3 years ago

Problem Description : Given an integer array 'nums', return the maximum result of nums[i] XOR nums[j], where 0 <= i <= j < n.

Example : Input : nums = [3,10,5,25,2,8] Output : 28 Explanation : The maximum result is 5 XOR 25 = 28.

My Contribution Details : I'll provide the well commented C++ code with the most optimal Time Complexity of O(n) and Space Complexity of O(1) using the Trie approach.

Kindly assign this issue to me.

Vanshikagarg17 commented 3 years ago

You can start working on this issue. All the best!