leetcodeSolution to some Leetcode problems written in C++ |
git clone git://git.dimitrijedobrota.com/leetcode.git |
Log | Files | Refs | README | LICENSE |
1598.cpp (328B)
0 class Solution { 1 public: 2 int minOperations(const vector<string> &logs) const { 3 int res = 0; 4 5 for (const auto &log : logs) { 6 if (log == "./") continue; 7 if (log == "../") 8 res -= res != 0; 9 else 10 res++; 11 } 12 13 return res; 14 } 15 };