Hi all applicants! Welcome to OrangeCap Internship Program 2024. Being an intern at OrangeCap is challenging so we have challenges for you! These challenges are designed to assess your learning skill, which is the fundamental and most important skill of a great software developer. So I do not expect you to have full or any knowledge about the topic beforehand but it's your job to try to learn and answer those challenges.
Please fork this repo and work on the test. After finishing the test, please send your repo to [email protected]
What you need to do is write the code that solve each question and put it in folder basic-js-ts. We will run your code with Node.js 12, so check your fancy feature before using it!
Write a function bracketMatcher
that receives a string. The function will return a number. If there is the brackets are correctly matched and each one is accounted for. Otherwise, return 0
Example
> bracketMatcher("(hello (world))")
1
> bracketMatcher("(hello (world)))")
0
Write a function secondMax
that receives an array of numbers. The function will return the second maximum value of the array. If there is no second max, return max instead. If an array is empty, throw and error.
Example
> secondMax([2, 3, 4, 5])
4
> secondMax([9, 2, 21, 21])
9
> secondMax([4, 4, 4, 4])
4
> secondMax([4123])
4123
> secondMax([])
Error!