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².

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("")); } })

#### Christian Harms

#### 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

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.