Search
⌘K

Leetcode 2011. Final Value of Variable After Performing Operations

Given a list of increment/decrement operation strings applied to a single variable X starting at 0, compute the final value by iterating through the operations and adding +1 for any "++" operation and −1 for any "--" operation. Essentially it's just counting net increments across the array.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.