Files
leetcode/2011-final-value-of-variable-after-performing-operations/2011-final-value-of-variable-after-performing-operations.py
T

4 lines
174 B
Python

class Solution:
def finalValueAfterOperations(self, operations: List[str]) -> int:
return sum(list(map(lambda x : 1 if x[1] == "+" else -1, operations)))