int function(int n){
int a[10]={0};
int result =0;
while(n){
if(a[n%10]==0){
a[n%10]=1;
result=10*result+n%10;
}
n/=10;
}
return result;`
}
On Wed, Sep 22, 2010 at 12:39 AM, Albert <[email protected]> wrote:
> Given a number find the number by eliminating the duplicate digits in
> the number..
>
> for eg: 24526 ans is 2456
> .....
>
>
> int function(int n)
> {
>
> .
> .
> .
>
> }
>
> Give all sort of solutions to this problem.....
>
> Efficiency in the code is important ....
>
> --
> 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]<algogeeks%[email protected]>
> .
> 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 [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.