Clever Algorithms in node.js