Intern — Senior
Checking the correctness of parentheses placement in a string
livecode
Task condition
Given a string consisting of opening and closing brackets. It is required to determine whether the brackets are correctly placed. A string is considered correct if:
- Each opening bracket has a closing bracket of the same type.
- Brackets are closed in the reverse order of their opening.
- For each closing bracket, a corresponding opening bracket is found.