It’s been a long time since I posted for the last time, but I promise I’ll try to keep this blog up-to-date 🙂

One of the purposes of this blog is to explore new technologies and recently I’ve been studying Ruby solving some puzzles posted by on JavaLobby.

The problem is about finding the second highest frequency of a character in a String. Below is the Ruby code, using the powerful concept of Ruby closures.

For the input String "aabbbc", the result is "a". I could done it in a more OOP style, but I chose a more concise solution 🙂

If you have another version in Ruby, feel free to post a comment!

Share and Enjoy:
  • Twitter
  • Digg
  • del.icio.us
  • Reddit
  • Facebook
  • Google Bookmarks
  • StumbleUpon
  • Technorati
  • FriendFeed
  • Google Buzz
  • MySpace
  • Slashdot