Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int solution(int A[], int N) {
- // write your code in C99 (gcc 4.8.2)
- unsigned i, j;
- if (N == 1)
- return A[0];
- for (i = 0, j = i+1; j<=N; j++) {
- if (A[i] != 0) {
- if (A[i] == A[j])
- A[j] = 0;
- else {
- if (j == N-1)
- return(A[i]);
- continue;
- }
- }
- j = ++i;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment