use a array
arr[char]=count char represent say a-z
count is # of occurances

while (*s!='\0')
{
arr[*s-'a']++;
if (arr[*s-'a']==1) lastchar=*s;
}


lastchar is the last non repeating char



Best Regards
Ashish Goel
"Think positive and find fuel in failure"
+919985813081
+919966006652


On Sun, Aug 22, 2010 at 3:30 PM, Saikat Debnath <saikat....@gmail.com>wrote:

> How to find last unique character in a given string. Unique character
> means non-repeated number. Give an optimized way.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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