Final Value of Variable After Performing Operations (Leetcode 2011)
Problem Link: https://leetcode.com/problems/final-value-of-variable-after-performing-operations/
class Solution:
def finalValueAfterOperations(self, operations: List[str]) -> int:
c=0
for i in operations:
if('+' in i):
c+=1
else:
c-=1
return c
PreviousReverse Prefix of Word (Leetcode 2000)NextMaximum Length of a Concatenated String with Unique Characters (Leetcode 1239)
Last updated