Skip to content

Latest commit

 

History

History
40 lines (29 loc) · 924 Bytes

_2011. Final Value of Variable After Performing Operations.md

File metadata and controls

40 lines (29 loc) · 924 Bytes

All prompts are owned by LeetCode. To view the prompt, click the title link above.

Back to top


First completed : June 03, 2024

Last updated : July 01, 2024


Related Topics : Array, String, Simulation

Acceptance Rate : 89.48 %


Solutions

C

int finalValueAfterOperations(char** operations, int operationsSize) {
    int output = 0;
    
    for (int i = 0; i < operationsSize; i++) {
        if (operations[i][1] == 43) {
            output++;
        } else {
            output--;
        }
    }
    return output;
}