Skip to content

Instantly share code, notes, and snippets.

@mdboop
Created October 27, 2020 07:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mdboop/6a90c1c53306ab0929434202bc12fc4d to your computer and use it in GitHub Desktop.
Save mdboop/6a90c1c53306ab0929434202bc12fc4d to your computer and use it in GitHub Desktop.
mock interview question
const assert = require("assert");
function matchingBrackets(str) {
// TODO: implement me!
}
// Test cases
assert.strictEqual(matchingBrackets("{}"), true);
assert.strictEqual(matchingBrackets("{"), false);
assert.strictEqual(matchingBrackets(""), true);
assert.strictEqual(matchingBrackets("{([])}"), true);
assert.strictEqual(matchingBrackets("{greet: func(a = []) { return a }}"), true);
assert.strictEqual(matchingBrackets("{greet: func(a = [] { return a }}"), false);
console.log("OK");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment