HTMLify
LeetCode - Maximum Nesting Depth of the Parentheses - Go
Views: 335 | Author: abh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | func maxDepth(s string) int { var depth, max_depth int for _, c := range s { if c == '(' { depth++ } if c == ')' { depth-- } if depth > max_depth { max_depth = depth } } return max_depth } |