solving codeeval challenges in Node.js