Skip to content

Commit 212be68

Browse files
Create 67. Add Binary
1 parent 88bdf6b commit 212be68

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

67. Add Binary

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class Solution {
2+
public:
3+
int finalValueAfterOperations(vector<string>& operations) {
4+
int n=operations.size()-1;
5+
int cnt=0;
6+
while(n>=0)
7+
{
8+
if(operations[n]=="--X"||operations[n]=="X--") cnt--;
9+
else cnt++;
10+
n--;
11+
}
12+
return cnt;
13+
}
14+
};

0 commit comments

Comments
 (0)