Valid Parentheses
easy⏱ 15 mintypescriptchallengesproblem-solving-basic-
APRENDE HACIENDOPon a prueba tu intuición3 pasos
Valid Parentheses
Usa los ejemplos y la explicación de la lección para comprobar tu idea.
Reflexión personal. No se envía a ningún servicio de IA.Caso de ejemplo — tu programa lee de stdin e imprime en stdout.
ENEste enunciado todavía está solo en inglés; la traducción al español está en camino.
Código inicial Given a string containing only '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
A string is valid if:
- Open brackets must be closed by the same type of brackets.
- Open brackets must be closed in the correct order.
- Every close bracket has a corresponding open bracket of the same type.
Example: '([{}])' → valid, '([)]' → invalid, '((()' → invalid
Formato de entrada
A single line containing the bracket string.
Formato de salida
'true' if valid, 'false' otherwise.
Restricciones
0 ≤ string.length ≤ 10⁴