Vague output value.


  • 0
    G

    In this question

    In the description input )()()) output is 4

    while in OJ input ()(() output is 2

    However there are 4 length balance parenthesis in ()(().

    Could some one explain the reason/difference between these two format.

    Thanks in advance.


  • 4
    T

    This question asks for substring instead of subsequence. ()() is a subsequence of ()(() not a substring while () is the longest balanced parenthesis substring for ()(()


  • 0
    G

    Thanks , I overlooked that point.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.