Skip to content

Commit a4a74b0

Browse files
authored
Create Final Value of Variable After Performing Operations.java
1 parent 962882e commit a4a74b0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class Solution {
2+
public int finalValueAfterOperations(String[] operations) {
3+
int x = 0;
4+
for (String op : operations) {
5+
x += op.indexOf('-') != -1 ? -1 : 1;
6+
}
7+
return x;
8+
}
9+
}

0 commit comments

Comments
 (0)