Created
October 27, 2020 07:52
-
-
Save mdboop/6a90c1c53306ab0929434202bc12fc4d to your computer and use it in GitHub Desktop.
mock interview question
This file contains 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
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