Very Simple JAVA 0 ms 100% faster easy for write
class Solution {
    public int finalValueAfterOperations(String[] operations) {
        int count = 0;
        for(int i = 0; i < operations.length; i++){
            if (operations[i].indexOf("+")>=0) count++;
            else if (operations[i].indexOf("-")>=0) count--;
        }    
        return count;
    }
        
}
Comments (0)