首页
题库
面试
求职
学习
竞赛
More+
所有博客
搜索面经/职位/试题/公司
搜索
我要招人
去企业版
登录 / 注册
首页
>
试题广场
>
最长有效括号
[编程题]最长有效括号
热度指数:280
时间限制:C/C++ 1秒,其他语言2秒
空间限制:C/C++ 256M,其他语言512M
算法知识视频讲解
给定一个只包含 '(' 和 ')' 的字符串,找出最长的包含有效括号的子串的长度。
示例1
输入
"(()"
输出
2
马上挑战
算法知识视频讲解
提交运行
算法知识视频讲解
添加笔记
求解答(0)
邀请回答
收藏(12)
分享
纠错
提交结果有问题?
3个回答
0篇题解
开通博客
暂无题解
问题信息
安卓工程师
阅文集团
2021
来自:
2023届阅文Andr...
上传者:
小小
难度:
3条回答
12收藏
3117浏览
热门推荐
通过挑战的用户
牛客69769...
2023-03-09 23:36:17
在敲键盘的小辣...
2023-03-05 15:14:46
牛客64029...
2023-02-22 21:56:16
ax220614
2023-02-02 20:29:23
牛客59576...
2023-01-11 14:01:07
相关试题
五月份的商品销售额为60万元,该月...
数据分析师
途虎
2021
评论
(2)
来自
途虎养车2023秋招数据...
下列哪两个变量之间的相关程度高
数据分析师
途虎
2021
评论
(4)
来自
途虎养车2023秋招数据...
onSaveInstanceSta...
安卓工程师
阅文集团
2021
评论
(1)
来自
2023届阅文Andro...
ActivityA跳转Activi...
安卓工程师
阅文集团
2021
评论
(1)
来自
2023届阅文Andro...
在电商支付模块测试中,需要对金额输...
软件测试
评论
(1)
最长有效括号
扫描二维码,关注牛客网
意见反馈
下载牛客APP,随时随地刷题
import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * @param s string字符串 * @return int整型 */ public int longestValidParentheses (String s) { // write code here } }
class Solution { public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * @param s string字符串 * @return int整型 */ int longestValidParentheses(string s) { // write code here } };
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # @param s string字符串 # @return int整型 # class Solution: def longestValidParentheses(self , s ): # write code here
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * @param s string字符串 * @return int整型 */ function longestValidParentheses( s ) { // write code here } module.exports = { longestValidParentheses : longestValidParentheses };
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # @param s string字符串 # @return int整型 # class Solution: def longestValidParentheses(self , s ): # write code here
package main /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * @param s string字符串 * @return int整型 */ func longestValidParentheses( s string ) int { // write code here }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * @param s string字符串 * @return int整型 */ int longestValidParentheses(char* s ) { // write code here }
"(()"
2