Balanced Brackets
Function Name: isBracketsBalanced
Description
In this task, you are required to write a function `isBracketsBalanced` that takes a single string parameter containing various types of brackets such as `(), {}, []`. The function must check whether the input string's brackets are balanced. In the context of this challenge, balanced brackets mean that each opening bracket has a matching closing bracket, and the pairs of brackets are properly nested. Your function must return a boolean result indicating whether the brackets are balanced or not.
Requirements
- The function must handle only the following characters: '(', ')', '{', '}', '[' and ']'.
- An empty string should be considered as a balanced string.
- The function should be case-sensitive, meaning that '(' does not match ']' or '}'.
- Do not ignore non-bracket characters. They're part of the challenge to check the context in which brackets appear.
- The function should return `true` if the sequence is balanced, and `false` otherwise.
Examples
`isBracketsBalanced('([{}])')` should return `true`.`isBracketsBalanced('(]')` should return `false`.`isBracketsBalanced('({[text](is)ok})')` should return `true`.`isBracketsBalanced('({text}fails]')` should return `false`.
Links
Matrix Spiral Copy
Sun Dec 29 2024
Write a function 'spiralCopy' that takes a 2D array (matrix) as an input and returns a list (or array) of elements in the order they are visited in a spiral traversal, starting from the top-left corner and proceeding inwards in a clockwise direction.
Prime Time
Tue Dec 31 2024
Write a function called isPrimeTime that determines whether the provided time (hours and minutes) can be represented as a prime number when concatenated. For instance, 15:31 would become 1531, and you would need to determine if 1531 is a prime number or not. Hours should be in the range of 0 to 23, and minutes should be in the range of 0 to 59. The function should not consider leading zeroes (e.g., 03:07 should be treated as 307).