2011.cpp (327B)
1 class Solution { 2 public: 3 int finalValueAfterOperations(const vector<string> &operations) const { 4 int res = 0; 5 6 for (const auto &op : operations) { 7 if (op.front() == '-' || op.back() == '-') 8 res--; 9 else 10 res++; 11 } 12 13 return res; 14 } 15 };