Easy  Solution 
IntuitionApproachStack for Score Tracking: Use a stack to store the scores at each step. This enables efficient operations like addition, removal, and duplicati
# Intuition
![bps.png](https://assets.leetcode.com/users/images/2f7c1f52-bb50-4853-9c5e-b07690425ba4_1738217738.1372793.png)
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
Stack for Score Tracking: Use a stack to store the scores at each step. This enables efficient operations like addition, removal, and duplication of scores.
Iterate through Operations:
Integer Push: Parse the integer (handle both positive and negative values) and push it onto the stack.
"C" Operation: Remove the last score by popping the stack.
"D" Operation: Push double the value of the last score onto the stack.
"+" Operation: Sum the top two scores, push the result back onto the stack while maintaining the stack's integrity.
Sum the Scores: Once all operations are processed, sum up all values in the stack to get the total score.
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity: O(N)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:O(N)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
cpp []
class Solution {
public:
    int calPoints(vector<string>& op) {
        stack<int> s;
        for(int i=0;i<op.size();i++){
             
              if(op[i]=="C"){
                s.pop();
             }
             else if(op[i]=="D"){
                int n=s.top();
                 
                s.push(n*2);
             }
              else if(op[i]=="+"){
                int t= s.top();
                s.pop();
                int se = s.top();
                s.pop();
                int sum= t+se;
                s.push(se);
                s.push(t);
                s.push(sum);
             }
             else{
                 s.push(stoi(op[i]));
             }
        }
        int add=0;
        while(!s.empty()){
            add+=s.top();
            s.pop();

        }
        return add;
        
    }
};
Quote
['C++']