Easy to Understand Code with Explanation (*^▽^*)[STACK]
Approach Using Stack\n\n\nclass Solution {\n    public int calPoints(String[] ops) {\n        Stack<Integer> st = new Stack<>();//creating a stack\n        for(
***Approach Using Stack***\n\n```\nclass Solution {\n    public int calPoints(String[] ops) {\n        Stack<Integer> st = new Stack<>();//creating a stack\n        for(String s :ops){//filling stack\n            if(s.equals("C")){ //if we got C in String then remove peek value in stack\n                st.pop();\n            }\n            else if (s.equals("D")){//if we got D in String then multiply the peek value of tack by 2\n                st.push(st.peek()*2);\n            }\n            else if(s.equals("+")){// if we got + in String then add the upermost 2 value of the stack\n                int temp = st.pop();// removing the peek value while storing it in temperary value\n                int sum = temp+st.peek();//now add both temp and the peek value\n                st.push(temp);//pushing back temp and then sum in order\n                st.push(sum);\n            }\n            else{// for all the interger value in string \n                st.push(Integer.parseInt(s));// converting string to interger\n            }\n        }\n        int res = 0;\n        for(int i :st){\n            res+=i;// adding all the value to stack in result \n        }\n        return res;\n    }\n}\n```\n<hr>\n<hr>\n\n***Time Complexity =O(N)\nSpace Complexity =O(N)***\n\n<hr>\n<hr>\n
['Stack']