Google jam solutions in javascript