Skip to content

Instantly share code, notes, and snippets.

View neurodrone's full-sized avatar
🌩️
Powering the cloud!

Vaibhav Bhembre neurodrone

🌩️
Powering the cloud!
View GitHub Profile
@neurodrone
neurodrone / beautiful_strings.c
Created January 26, 2013 15:17
Facebook Hacker Cup 2013
/***
When John was a little kid he didn't have much to do. There was no internet, no Facebook, and no programs to hack on.
So he did the only thing he could... he evaluated the beauty of strings in a quest to discover the most beautiful string
in the world. Given a string s, little Johnny defined the beauty of the string as the sum of the beauty of the letters in it.
The beauty of each letter is an integer between 1 and 26, inclusive, and no two letters have the same beauty.
Johnny doesn't care about whether letters are uppercase or lowercase, so that doesn't affect the beauty of a letter.
(Uppercase 'F' is exactly as beautiful as lowercase 'f', for example.) You're a student writing a report on the youth of