Skip to content

Commit 5252332

Browse files
committed
#2011: description update
1 parent ac8cd53 commit 5252332

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

c-sharp/Problems/arrays-and-hashing/FinalValueOfVariableAfterPerformingOperations.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
* Final Value of Variable After Performing Operations
44
**
55
* There is a programming language with only four operations and one variable X:
6-
* ++X and X++ increments the value of the variable X by 1.
7-
* --X and X-- decrements the value of the variable X by 1.
6+
* ++X and X++ increments the value of the variable X by 1.
7+
* --X and X-- decrements the value of the variable X by 1.
88
*
99
* Initially, the value of X is 0.
1010
* Given an array of strings operations containing a list of operations,
1111
* return the final value of X after performing all the operations.
12-
*
12+
*
1313
* Example 1:
1414
* Input: operations = ["--X","X++","X++"]
1515
* Output: 1
@@ -19,7 +19,6 @@
1919
* X++: X is incremented by 1, X = -1 + 1 = 0.
2020
* X++: X is incremented by 1, X = 0 + 1 = 1.
2121
*
22-
*
2322
* Example 2:
2423
* Input: operations = ["++X","++X","X++"]
2524
* Output: 3
@@ -29,7 +28,6 @@
2928
* ++X: X is incremented by 1, X = 1 + 1 = 2.
3029
* X++: X is incremented by 1, X = 2 + 1 = 3.
3130
*
32-
*
3331
* Example 3:
3432
* Input: operations = ["X++","++X","--X","X--"]
3533
* Output: 0
@@ -39,7 +37,11 @@
3937
* ++X: X is incremented by 1, X = 1 + 1 = 2.
4038
* --X: X is decremented by 1, X = 2 - 1 = 1.
4139
* X--: X is decremented by 1, X = 1 - 1 = 0.
42-
*
40+
*
41+
* Constraints:
42+
* • 1 <= operations.length <= 100
43+
* • operations[i] will be either "++X", "X++", "--X", or "X--".
44+
*
4345
* Hint 1: There are only two operations to keep track of.
4446
* Hint 2: Use a variable to store the value after each operation.
4547
**

0 commit comments

Comments
 (0)