Final Value of Variable After Performing Operations
class Solution {
public int finalValueAfterOperations(String[] operations) {
int res = 0;
String a = "++X";
String b = "X++";
for(String o : operations)
{
if(o.equals(a) || o.equals(b))
res++;
else
res--;
}
return res;
}
}