Skip to content

Commit e00894c

Browse files
authored
Merge pull request #622 from Vedeesh6/Vedeesh6-patch-1
Add LC_finvalvarafterop class for operation evaluation
2 parents 5f171b0 + d9e2d61 commit e00894c

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class LC_finvalvarafterop {
2+
3+
public int finalValueAfterOperations(String[] operations) {
4+
int x = 0;
5+
for (String op : operations) {
6+
if ("X++".equals(op) || "++X".equals(op)) {
7+
x++;
8+
} else {
9+
x--;
10+
}
11+
}
12+
return x;
13+
}
14+
}

0 commit comments

Comments
 (0)