Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Quick way to find the letter with the most occurences in a string

by wanna_code_perl (Pilgrim)
on May 19, 2010 at 16:43 UTC ( #840732=note: print w/replies, xml ) Need Help??


in reply to Quick way to find the letter with the most occurences in a string

You have to count, unless you're OK with an approximation.

print chr(rand(3)+65);

It's short, runs in constant time, and is right 1/3 of the time. :-)

  • Comment on Re: Quick way to find the letter with the most occurences in a string
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://840732]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2017-11-19 05:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (278 votes). Check out past polls.

    Notices?