lc032

package
v0.0.0-...-b071cee Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 9, 2023 License: GPL-3.0 Imports: 0 Imported by: 0

README

32.最长有效括号

1. 题目描述

给你一个只包含 '('  和 ')'  的字符串,找出最长有效(格式正确且连续)括号子串的长度。

  示例 1:


输入:s = "(()"
输出:2
解释:最长有效括号子串是 "()"

示例 2:


输入:s = ")()())"
输出:4
解释:最长有效括号子串是 "()()"

示例 3:


输入:s = ""
输出:0

 

提示:

  • 0 <= s.length <= 3 * 10^4
  • s[i]'('')'

标签 字符串 动态规划

2. 解题

动态规划 栈

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL