united-coders

TwitterFacebookGoogleRSS
  • Home
  • Authors
    • Christian Harms
    • Nico Heid
  • Newsletter
Home » facebook Hacker Cup 2012 Qualification Round

facebook Hacker Cup 2012 Qualification Round

Posted on January 17, 2012 by Christian Harms Posted in Uncategorized 1 Comment

The facebook hacker cup is a google-code-jam like coding contest – starting with the 2012 qualification round this weekend. Try to solve the 2011 practice round. If you can submit your solution (the spinner after submit dont stops) try to check the result response with HTTPFox (it shows the correct / incorrect response) – hoping this will be fixed for this weekend.

All solutions can be testet with codejammer.com – a fine javascript solution for running code contests like facebook hacker cup or google code jam.

 

Qualification Round – Double Squares

A double-square number is an integer X which can be expressed as the sum of two perfect squares. For example, 10 is a double-square because 10 = 3² + 1². Your task in this problem is, given X, determine the number of ways in which it can be written as the sum of two squares. For example, 10 can only be written as 3² + 1² (we don’t count 1² + 3² as being different). On the other hand, 25 can be written as 5² + 0² or as 4² + 3².

codejamer.com screenshot

codejamer.com screenshot

See the input data in the screen shot.

({
  init: function(input) { input.shift(); return input; },
  task: function(input, callback) {
    var a,b, count=0, sum = +input.data;
    for (a=0; a

Facebook Hacker Cup Qualification Round – Studious Student

You’ve been given a list of words to study and memorize. Being a diligent student of language and the arts, you’ve decided to not study them at all and instead make up pointless games based on them. One game you’ve come up with is to see how you can concatenate the words to generate the lexicographically lowest possible string.

Inputdata:

5
6 facebook hacker cup for studious students
5 k duz q rc lvraw
5 mybea zdr yubx xe dyroiy
5 jibw ji jp bw jibw
5 uiuy hopji li j dcyi

Result:

Case #1: cupfacebookforhackerstudentsstudious
Case #2: duzklvrawqrc
Case #3: dyroiymybeaxeyubxzdr
Case #4: bwjibwjibwjijp
Case #5: dcyihopjijliuiuy

And my small javascript solution:

({
  init: function(input) { input.shift(); return input; },
  task: function(input, callback) {
    var s = input.data.substr(2).split(" ");
    s.sort(function(a,b){return (a+b>b+a)*2-1})
    callback('Case #' + input.index + ': ' + s.join(""));
  }
})
  • Bio
  • Latest Posts
My Google+ profile

Christian Harms

I am working as a software developer and project manager in germany. After my graduate computer science I started in 2000 as a developer for a warehouse management system. my python knowledge grow up as a team member for one of the TOP3 german portal and freemail services. 2012 switched to the automotive industry to share my knowledge about open source and agile development. In spare time I submit to some coding contests and interesed in smaller developments.

Latest posts by Christian Harms (see all)

  • google code jam 2013 – tic-tac-toe-Tomek solution - April 16, 2013
  • Google code jam 2013 – the lawnmower - April 14, 2013
  • code puzzles and permutations - April 11, 2013
hackercup javascript
« Q*Bert chrismas tree puzzle
facebook Hacker Cup 2012 Qualification Round – alphabet soup »

One thought on “facebook Hacker Cup 2012 Qualification Round”

  1. How to start a blog says:
    January 19, 2012 at 10:01

    Hey, I am not tech savy but looking to this post it seems to be an interesting stuff, Coding those not easy from distance but once we are into it, can prove very interesting topic to play with.

Leave a comment Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Tags

android code jam code puzzle hackercup hosting java javascript permutations project euler python server

Recent Comments

  • garcinia cambogia walmart on Free IP to Geo Location script
  • Yoda Conditions | Pack 6 – Palo Alto on What are yoda conditions?
  • Nico Heid on The art of escaping
  • hardik on Use Android ActivityGroup within TabHost to show different Activity
  • james on Use Android ActivityGroup within TabHost to show different Activity

Recent Posts

  • A scalable, affordable WordPress hosting, lessons learned
  • google code jam 2013 – tic-tac-toe-Tomek solution
  • Google code jam 2013 – the lawnmower
  • code puzzles and permutations
  • Code Jam – Candy Splitting

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org

Copyright

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
© united-coders
  • The facebook hacker cup is a google-code-jam like coding contest - starting with the 2012 qualification round this weekend. Try to solve the 2011 practice round. If you can submit your solution (the spinner after submit dont stops) try to check the result response with HTTPFox (i