GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • 注册
  • Plus 会员

This view

  • Original page
  • New address

GeezerVison is showing leetcode.cn — 678. 有效的括号字符串 - 力扣(LeetCode)

题目描述
题目描述
题解
题解
提交记录
提交记录
678. 有效的括号字符串
中等

给你一个只包含三种字符的字符串,支持的字符类型分别是 '('、')' 和 '*'。请你检验这个字符串是否为有效字符串,如果是 有效 字符串返回 true 。

有效 字符串符合如下规则:

  • 任何左括号 '(' 必须有相应的右括号 ')'。
  • 任何右括号 ')' 必须有相应的左括号 '(' 。
  • 左括号 '(' 必须在对应的右括号之前 ')'。
  • '*' 可以被视为单个右括号 ')' ,或单个左括号 '(' ,或一个空字符串 ""。

 

示例 1:

输入:s = "()"
输出:true

示例 2:

输入:s = "(*)"
输出:true

示例 3:

输入:s = "(*))"
输出:true

 

提示:

  • 1 <= s.length <= 100
  • s[i] 为 '('、')' 或 '*'
 
代码
代码
测试用例
测试用例
测试结果
测试结果
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.