2011. Final Value of Variable After Performing Operations
There is a programming language with only four operations and one variable
X:
++XandX++increments the value of the variableXby1.--XandX--decrements the value of the variableXby1.Initially, the value of
Xis0.Given an array of strings
operationscontaining a list of operations, return the final value ofXafter performing all the operations.
1 | class Solution { |