mirror of
https://github.com/devenperez/leetcode.git
synced 2026-06-13 14:57:08 +00:00
Time: 56 ms (71.78%), Space: 13.8 MB (95.80%) - LeetHub
This commit is contained in:
+1
-8
@@ -1,11 +1,4 @@
|
||||
class Solution:
|
||||
def finalValueAfterOperations(self, operations: List[str]) -> int:
|
||||
value = 0
|
||||
|
||||
for op in operations:
|
||||
if op[1] == "+":
|
||||
value += 1
|
||||
else:
|
||||
value -= 1
|
||||
|
||||
return value
|
||||
return sum(list(map(lambda x : 1 if x[1] == "+" else -1, operations)))
|
||||
Reference in New Issue
Block a user