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)


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