Wednesday, January 30, 2013

Facebook Hacker Cup 2013


  This weekend during our company trip to Mexico, a group of us decided to participate in the qualification rounds for the Facebook Hacker Cup, 2013.  I missed last years, but love these types of competitions.  Its significantly smaller than the Google Code Jam, but the format is similar.  There were three problems in the qualification round, if you got any of them, you moved on to the next round (which I believe is this coming weekend).  You can use whatever language you'd like to answer the questions, as you download an input file which you have to provide outputs for within a given time frame (in this case, 6 minutes).

  The first problem, called "beautiful strings", was to find a one to one mapping between letters and values 1-26, and return the maximum possible score that a string could achieve.  I ran into problems misinterpreting the problem in a variety of ways... first assuming that it was a global one time mapping that produced the scores, and then assuming that the scores were for the best word in the string.  Once that was cleared up, the solution came quickly.

  The second problem, called "balanced smileys", was to determine if a string could be interpreted as having balanced parenthesis if you were allowed to interpret emoticons either as a face or as a colon parens combo...  I had some flashbacks to a recursive descent parser we did in school, so writing such a parser with a lookahead was pretty easy, and it only took maybe another hour to do that part.

  At this point, we were getting heckled by coworkers for wasting our vacation on programming problems, and spent the night drinking and partying... the qualification round was something like 72 hours, so we had to stop.  The plan was to come back and finish it the next day...


  But that night, the norovirus struck the resort hard, myself included.  The next few days were spent battling that rather than facebook problems.  Too bad, would have loved to get that last problem knocked out.

  Looking forward to the next round, coming up this weekend...  Hope to see you there!

No comments:

Post a Comment