leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

1111.cpp (356B)


0 class Solution {
1 public:
2 vector<int> maxDepthAfterSplit(const string &seq) {
3 vector<int> res;
4 res.reserve(seq.size());
5 for (int i = 0, count = 0; i < seq.size(); i++) {
6 if (seq[i] == '(') count++;
7 res.push_back(count % 2);
8 if (seq[i] == ')') count--;
9 }
10 return res;
11 }
12 };