Guest User

Untitled

a guest
Aug 11th, 2016
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. int solution(int A[], int N) {
  2. // write your code in C99 (gcc 4.8.2)
  3. unsigned i, j;
  4.  
  5. if (N == 1)
  6. return A[0];
  7.  
  8. for (i = 0, j = i+1; j<=N; j++) {
  9. if (A[i] != 0) {
  10. if (A[i] == A[j])
  11. A[j] = 0;
  12. else {
  13. if (j == N-1)
  14. return(A[i]);
  15. continue;
  16. }
  17. }
  18. j = ++i;
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment