Skip to content

Instantly share code, notes, and snippets.

/**
* Time complexity: O(6)
* Space complexity: O(3n) - almost 3x original array size? No entirely sure
*
* Assumes that the inputs are valid
*
* @param openingParenthesisIndex Zero based index of '(' in str
* @param str String to search - must be equal # of '(' and ')'
*/
const getCorrespondingClosingParenthesesIndex = (openingParenthesisIndex: number, str: string): number => {
// Type JavaScript here and click "Run Code" or press Ctrl + s
console.log('Hello, world!');
// CHALLENGE 1
function createFunction() {
return function () {
console.log('hello');
}
}
// Type JavaScript here and click "Run Code" or press Ctrl + s
// Challenge 1
function addTwo(num) {
return num + 2;
}
// To check if you've completed it, uncomment these console.logs!
console.log(addTwo(3));