Skip to content

[Algo] Valid Parentheses #53

@Jeanedlune

Description

@Jeanedlune

Problem: Valid Parentheses

Determine if a string containing parentheses, brackets, and braces is valid.

A string is valid if:

  • Every opening bracket has a corresponding closing bracket
  • Brackets are closed in the correct order

Constraints

  • 1 <= s.length <= 10^4
  • s contains only '(', ')', '{', '}', '[', ']'

Example

Input: s = "({[]})"
Output: true

Input: s = "({[}])"
Output: false

Complexity

  • Time: O(n)
  • Space: O(n)

Contribution Guidelines

  • Implement in one language (we'll add others later)
  • Include README with problem statement and test cases
  • Add test harness in your implementation
  • Follow code style guide in .gemini/styleguide.md

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions