Skip to content

Commit 39aeffe

Browse files
committed
Create 1111.有效括号的嵌套深度.js
1 parent 6ac2538 commit 39aeffe

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

1111.有效括号的嵌套深度.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* @param {string} seq
3+
* @return {number[]}
4+
*/
5+
var maxDepthAfterSplit = function(seq) {
6+
const result = [];
7+
for (let i = 0; i < seq.length; i++) {
8+
result[i] = seq[i] === '(' ? (i % 2) : ((i + 1) % 2);
9+
}
10+
return result;
11+
};

0 commit comments

Comments
 (0)