Skip to content

Commit 3fbd919

Browse files
add 2011
1 parent 49be19b commit 3fbd919

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ _If you like this project, please leave me a star._ ★
88

99
| # | Title | Solutions | Video | Difficulty | Tag
1010
|-----|----------------|---------------|--------|-------------|-------------
11+
|2011|[Final Value of Variable After Performing Operations](https://leetcode.com/problems/final-value-of-variable-after-performing-operations/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2011.java) ||Easy||
1112
|2007|[Find Original Array From Doubled Array](https://leetcode.com/problems/find-original-array-from-doubled-array/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2007.java) ||Medium||
1213
|2006|[Count Number of Pairs With Absolute Difference K](https://leetcode.com/problems/count-number-of-pairs-with-absolute-difference-k/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2006.java) ||Easy||
1314
|2001|[Number of Pairs of Interchangeable Rectangles](https://leetcode.com/problems/number-of-pairs-of-interchangeable-rectangles/)|[Python3](../master/python3/2001.py), [Java](../master/src/main/java/com/fishercoder/solutions/_2001.java) ||Medium||
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.fishercoder.solutions;
2+
3+
public class _2011 {
4+
public static class Solution1 {
5+
public int finalValueAfterOperations(String[] operations) {
6+
int val = 0;
7+
for (String op : operations) {
8+
if (op.equals("++X") || op.equals("X++")) {
9+
val++;
10+
} else {
11+
val--;
12+
}
13+
}
14+
return val;
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)