C# Code Challenges Solved on LeetCode
Level:
Language: C#
Topic: String
A string is a valid parentheses string (denoted VPS) if it meets one of the following:
""
, or a single character not equal to "("
or ")"
AB
(A
concatenated with B
), where A
and B
are VPS’s(A)
, where A
is a VPS.We can similarly define the nesting depth depth(S)
of any VPS S
as follows:
For example, ""
, "()()"
, and "()(()())"
are VPS’s (with nesting depths 0, 1, and 2), and ")("
and "(()"
are not VPS’s.
Given a VPS represented as string s
, return the nesting depth of s
.
1 <= s.length <= 100
'+'
, '-'
, '*'
, '/'
, '('
, and ')'
.s
is a VPS.