mirror of
https://github.com/devenperez/leetcode.git
synced 2026-06-13 14:57:08 +00:00
Time: 57 ms (66.84%), Space: 13.8 MB (52.98%) - LeetHub
This commit is contained in:
+11
@@ -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
|
||||
Reference in New Issue
Block a user