my solution solve the problem in O(n) time but requre space comlexty n.
solution:
1. take an temp array and initialize it elements with zero;
    int temp[n]={0};
2.increment the count of the element of temp which is appear when loop
through the given array say a[n];
  for(int i=0;i<n;i++)
     temp[a[i]]++;
3.Now print the elements of the temp array whose values is 1.and it is the
requered solution.
  for(int i=0i<n;i++)
 {
   if(temp[i]==1)
      printf("%d",a[i]);
 }

hope it works fine.
Is there any solution which also optimize space also.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to