Time: 57 ms (66.84%), Space: 13.8 MB (52.98%) - LeetHub

This commit is contained in:
Deven
2023-01-14 20:24:11 -05:00
parent 32c0e9cb53
commit cf3e8b4651
@@ -0,0 +1,11 @@
class Solution:
def finalValueAfterOperations(self, operations: List[str]) -> int:
value = 0
for op in operations:
if "+" in [op[0], op[-1]]:
value += 1
else:
value -= 1
return value