Time: 56 ms (71.78%), Space: 13.8 MB (95.80%) - LeetHub

This commit is contained in:
Deven
2023-01-14 20:28:20 -05:00
parent c57e38b908
commit d15c4d232f
@@ -1,11 +1,4 @@
class Solution: class Solution:
def finalValueAfterOperations(self, operations: List[str]) -> int: def finalValueAfterOperations(self, operations: List[str]) -> int:
value = 0
for op in operations: return sum(list(map(lambda x : 1 if x[1] == "+" else -1, operations)))
if op[1] == "+":
value += 1
else:
value -= 1
return value