@ashish: ankur's solution is not O(n^2) in the worst case it would take O(n log(max(a)) ) since it goes one pass for each bit and if a[i] is guaranteed to be a 32 bit integer we can argue that it is O(n)
-- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@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.