Dont know whether this is perfect solution but could be a great approach Assumptions: all numbers are unsigned as given in the link provided by Dipit
If u see a bit arrangement of unsingned numbers having n bits then u will find that numbers m & ((2^n) - 1- m) (i.e numbers whos addition is 2^n -1) have maxium XOR which is ((2^n) - 1), solution: Even if u find numbers which have closer addition to ((2^n) - 1), but maximum difference between them could have maximum XOR. above is possible if u sort array Solution may not be perfect as i have not tested it for many i/n as well as I have not thought in depth. On Thu, Feb 23, 2012 at 2:51 PM, Dipit Grover <dipitgro...@gmail.com> wrote: > http://discuss.joelonsoftware.com/default.asp?interview.11.614716 > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- Regards, Rahul Patil -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.