Use C++ bitset class. It requires O(MaxValue / 8) bytes to represent set of integers with maximum number is MaxValue. To find repeated number: Iterate over the array. For each number check if it is already inserted into a bitset. If yes, then we find duplicated element. Otherwise, insert current number into a set (simply set up appropriate bit in the bitset). This approach is O(n).
On 20 окт, 14:35, Asquare <anshika.sp...@gmail.com> wrote: > @juver++ - could u plz elaborate.. -- 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.