This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var buildCtrl = function(promiseFn){ | |
| return function(req, res) { | |
| promiseFn(req) | |
| .then(function(data){ | |
| res.json(200, data); | |
| }, function(e){ | |
| res.status(e.httpCode || 500) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function BinaryIndexTree(size) { | |
| this._tree = new Array(size + 1); | |
| this._size = size; | |
| for (var i = 0; i <= size; ++i) { | |
| this._tree[i] = 0; | |
| } | |
| } | |
| BinaryIndexTree.prototype.update = function(idx, value) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Modified Ford-Fulkerson algorithm | |
| function mbp(matrix, isConnected) { | |
| var N = matrix.length; | |
| var M = matrix[0].length; | |
| var visited = new Array(M); | |
| var matches = new Array(M); | |
| var res = 0; | |
| isConnected = isConnected || function(x) {return x;}; | |
| function hasMatch(u) { |