← All problemsSign in

2011. Final Value of Variable After Performing Operations

LeetCodeArrayStringSimulationOpen on judge ↗

There is a programming language with only four operations and one variable X: - ++X and X++ increments the value of the variable X by 1. - --X and X-- decrements the value of the variable X by 1. Initially, the value of X is 0. Given an array of strings operations containing a list of operations, return the final value of X after performing all the operations. Example 1: Input: operations

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start