There is a single variable X that initially has a value of
You are given an array of strings operations containing operations that modify the value of X:
"++X" and "X++" increment the value of X by
"--X" and "X--" decrement the value of X by
Return the final value of X after executing all the operations in operations.
Constraints:
operations.length
operations[i] will be either "++X", "X++", "--X", or "X--".
There is a single variable X that initially has a value of
You are given an array of strings operations containing operations that modify the value of X:
"++X" and "X++" increment the value of X by
"--X" and "X--" decrement the value of X by
Return the final value of X after executing all the operations in operations.
Constraints:
operations.length
operations[i] will be either "++X", "X++", "--X", or "X--".