An array of integers, all appear twice except one, find this number.

Go down

An array of integers, all appear twice except one, find this number.

Post  viterbi on Tue Sep 13, 2011 10:00 am

1____int unique_number(int a[], int l) {
2__________int q = a[0];
3__________for (int i=1; i<l; i++) q = q^a[i];
4__________return q;
5____}

viterbi

Posts : 32
Join date : 2011-09-03

View user profile

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum