leetcode

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

2011.cpp (327B)


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