Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,8 @@ var TreeNode = function(val) {
this.left = this.right = null;
}

console.log(
buildTree(
[3,9,20,15,7],
[9,3,15,20,7]
)
);
var main = function() {
console.log(buildTree([3,9,20,15,7], [9,3,15,20,7]));
}

module.exports.main = main
12 changes: 8 additions & 4 deletions Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ var main = async function() {
for(i in problems) {
console.log("Solving: " + problems[i] + ":");
const problem = require(PROBLEMS_FOLDER + problems[i]);
problem.main();
console.log("End of the solution for : " + problems[i] + ",\n\n");
if (typeof(problem.main) !=='undefined') {
problem.main();
console.log("End of the solution for : " + problems[i] + ",\n\n");
} else {
console.warn(problem, "The problem " + problems[i] + " doesn't have a main method implemented.");
}
}
} catch (error) {
throw new Error(error);
Expand All @@ -23,8 +27,8 @@ var loadProblems = () => {
if (error) {
reject(error);
} else {
problems = files.filter(item => !(REGEX_PATTERN_HIDDEN_FILES).test(item));
resolve(problems);
problems = files.filter(item => !(REGEX_PATTERN_HIDDEN_FILES).test(item));
resolve(problems);
}
})
});
Expand Down