icimence / icimence.github.io

icimence's Tech blog
https://icimence.github.io/
2 stars 0 forks source link

LeetCode第32题动归思路 | icimence's Tech Blog #61

Open icimence opened 2 years ago

icimence commented 2 years ago

https://ali.icimence.cn/2022/01/16/LeetCode%E7%AC%AC32%E9%A2%98%E5%8A%A8%E5%BD%92%E6%80%9D%E8%B7%AF/

原题给你一个只包含 ‘(‘ 和 ‘)’ 的字符串,找出最长有效(格式正确且连续)括号子串的长度。 示例 1: 123输入:s = "(()"输出:2解释:最长有效括号子串是 "()" 示例 2: 123输入:s = ")()())"输出:4解释:最长有效括号子串是 "()()" 示例 3: 12输入:s = &quot