Difficulty
Easy
Language
Python
Solution 1 - Count +/− Operations
Each op increments if it contains '+', else decrements.
""" 2011.1 - Final Value of Variable After Performing Operations - Solution 1 """
from typing import List
class Solution:
def finalValueAfterOperations(self, operations: List[str]) -> int:
x = 0
for op in operations:
x += 1 if "+" in op else -1
return x