Java || Stack || Explained
Intuition\nFor D -> stack.peek() x 2 ... So then we will have twice the value of Last\nFor C -> stack.pop() ... Invalidate last Score\nFor + -> x=stack.pop() , 
# Intuition\nFor **D** -> **stack.peek() x 2** ... So then we will have twice the value of Last\nFor **C** -> **stack.pop()** ... Invalidate last Score\nFor **+** -> **x=stack.pop() , y=stack.pop() , z=x+y ,then push y,x,z resp..**\nFor **x** -> **stack.push(Integer.parseInt(x)))**\n\n\n# Code\n```\nclass Solution {\n    public int calPoints(String[] operations) {\n        Stack<Integer> stack=new Stack<>();\n        \n        for(int i=0;i<operations.length;i++){\n        if(operations[i].equals("C")){\n                stack.pop();\n            }\n\n        else if(operations[i].equals("D")){\n            stack.push(stack.peek()*2);\n        }\n        else if(operations[i].equals("+")){\n            int x=stack.pop();\n            int y=stack.pop();\n            int z=x+y;\n            stack.push(y);\n            stack.push(x);\n            stack.push(z);\n        }\n        else{\n            stack.push(Integer.parseInt(operations[i]));\n        }\n        }\n        int sum=0;\n        while(!stack.isEmpty()){\n            sum+=stack.pop();\n        }\n        return sum;\n    }\n}\n```
['Stack', 'Simulation', 'Java']