Just another Perl shrine | |
PerlMonks |
Re: Determining uniqueness in a stringby LucaPette (Friar) |
on Oct 02, 2005 at 09:28 UTC ( [id://496733]=note: print w/replies, xml ) | Need Help?? |
Hi,
Unfortunately at this moment i can't test the speed of my little idea about your problem. Well, i think that a simple solution is to add all digits and test if the result is 45, infact the sum of all digits in a ten character string is 45 only where every digit from the set 0-9 occurs exactly once, according to the Gauss' formula (N*(N*1)/2). I hope that, in spite of my ugly english, this little idea can help someone.
In Section
Seekers of Perl Wisdom
|
|