deno.land / x / masx200_leetcode_test@10.6.5 / maximum-nesting-depth-of-the-parentheses / index.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
export default function maxDepth(s: string): number { let ans = 0; let depth = 0; for (const char of s) { if (char === "(") { depth++; ans = Math.max(depth, ans); } else if (char === ")") { depth--; } } return ans;}
masx200_leetcode_test

Version Info

Tagged at
a year ago