Sanitize Parentheses in Expression
bitburner吧
全部回复
仅看楼主
level 1
taoyongming 楼主
有大佬帮解下吗
You are attempting to solve a Coding Contract. You have 9 tries remaining, after which the contract will self-destruct.
Given the following string:
())())a)(((a()a))
remove the minimum number of invalid parentheses in order to validate the string. If there are multiple minimal ways to validate the string, provide all of the possible results. The answer should be provided as an array of strings. If it is impossible to validate the string the result should be an array with only an empty string.
IMPORTANT: The string may contain letters, not just parentheses. Examples:
"()())()" -> [()()(), (())()]
"(a)())()" -> [(a)()(), (a())()]
")( -> [""]
2022年01月26日 07点01分 1
level 1
['()()a(((a)a))', '()()a((a()a))', '()(a)(((a)a))', '()(a)((a()a))', '(())a(((a)a))', '(())a((a()a))', '(()a)(((a)a))', '(()a)((a()a))']
2022年01月26日 12点01分 2
1