package
Version:
v0.0.0-...-a49be92
Opens a new window with list of versions in this module.
Published: Feb 20, 2024
License: MIT
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
使括号有效的最少添加
只有满足下面几点之一,括号字符串才是有效的:
-
它是一个空字符串,或者
-
它可以被写成 AB
(A
与 B
连接), 其中 A
和 B
都是有效字符串,或者
-
它可以被写作 (A)
,其中 A
是有效字符串。
给定一个括号字符串 s
,移动N次,你就可以在字符串的任何位置插入一个括号。
-
例如,如果 s = "()))"
,你可以插入一个开始括号为 "(()))"
或结束括号为 "())))"
。
返回 为使结果字符串 s
有效而必须添加的最少括号数。
示例 1:
输入:s = "())"
输出:1
示例 2:
输入:s = "((("
输出:3
提示:
1 <= s.length <= 1000
s
只包含 '('
和 ')'
字符。
Documentation
¶
There is no documentation for this package.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.