← ALL NOTES
Array

2011. Final Value of Variable After Performing Operations

Operations on a variable X (starting at 0): "++X" and "X++" add 1; "--X" and "X--" subtract 1. Return the final X. Each operation moves X by ±1; detect the direction from whether the string contains…

Loading…