leetle

Daily challenge for 2026-01-02

367. Simple Bracket Sequence Validator

Given a string s consisting only of opening '(' and closing ')' parentheses, determine if the input string is valid. An input string is valid if:
1. Open brackets must be closed by the same type of brackets.
2. Open brackets must be closed in the correct order.

This problem is simplified to only use one type of bracket.

Example 1:
Input: s = "()()"
Output: true

Example 2:
Input: s = ")("
Output: false

Example 3:
Input: s = "(())"
Output: true

Run this challenge interactively in Python or JavaScript when the app loads.