Kind of brute force with O(n*log(n))

map m<int, int>;
for( int i=0; i<N; i++)
     m[a[i]]++;
for each element in hashmap
     if( m[i] == 3)
          print i;

On Sun, Feb 27, 2011 at 3:59 AM, Dave <dave_and_da...@juno.com> wrote:
> @Radha: Please explain your method further. You can use this data:
> 0, 1, 2, 4, 4, 5, 5, 6, 6, 6.
>
> Dave
>
> On Feb 26, 10:44 am, radha krishnan <radhakrishnance...@gmail.com>
> wrote:
>> XOR :P
>>
>>
>>
>> On Sat, Feb 26, 2011 at 10:11 PM, bittu <shashank7andr...@gmail.com> wrote:
>> > Given an array of integers where some numbers repeat 1 time, some
>> > numbers repeat 2 times and only one number repeats 3 times, how do you
>> > find the number that repeat 3 times.
>>
>> > Thanks
>> > Shashank
>>
>> > --
>> > 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 
>> > athttp://groups.google.com/group/algogeeks?hl=en.- Hide quoted text -
>>
>> - Show quoted text -
>
> --
> 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.
>
>



-- 
Thanks & Regards,
Gaurav Gupta
Associate Software Engineer
IBM Software Lab India
Email: gauravgupta[at]in[dot]ibm[dot]com
Ph No. : +91-7676-999-350

"Quality is never an accident. It is always result of intelligent
effort" - John Ruskin

-- 
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.

Reply via email to