leetcode

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

1598.cpp (328B)


      1 class Solution {
      2   public:
      3     int minOperations(const vector<string> &logs) const {
      4         int res = 0;
      5 
      6         for (const auto &log : logs) {
      7             if (log == "./") continue;
      8             if (log == "../")
      9                 res -= res != 0;
     10             else
     11                 res++;
     12         }
     13 
     14         return res;
     15     }
     16 };