problemscpp
A collection of my answers to algorithm problems in c++.
静态 Public 成员函数 | 所有成员列表
leetcode::maximum_nesting_depth_of_the_parentheses::Solution类 参考

#include <leetcode.h>

静态 Public 成员函数

static int maxDepth (const string &s)
 

详细描述

在文件 leetcode.h268 行定义.

成员函数说明

◆ maxDepth()

int leetcode::maximum_nesting_depth_of_the_parentheses::Solution::maxDepth ( const string &  s)
static

在文件 leetcode.cpp597 行定义.

597 {
598 int max = 0;
599 int current = 0;
600 for(const char ch: s) {
601 if(ch == '(') {
602 current++;
603 } else if(ch == ')') {
604 current--;
605 }
606 if(max < current) {
607 max = current;
608 }
609 }
610 return max;
611 }

被这些函数引用 leetcode::maximum_nesting_depth_of_the_parentheses::TEST().


该类的文档由以下文件生成: