Straightforward Java with List
\nclass Solution {\n    public int calPoints(String[] ops) {\n        int score = 0;\n        List<Integer> ls = new ArrayList<Integer>();\n        for (int i =
```\nclass Solution {\n    public int calPoints(String[] ops) {\n        int score = 0;\n        List<Integer> ls = new ArrayList<Integer>();\n        for (int i = 0; i < ops.length; i++) {\n            String s = ops[i];\n            if (s.equals("+")) {\n            \tint num = 0;\n            \tfor (int ii = 0, il = ls.size() - 1; ii < 2 && il >= 0; ii++, il--)\n            \t\tnum += ls.get(il);\n            \tscore += num;\n            \tls.add(num);\n            } else if (s.equals("C")) {\n            \tint num = ls.get(ls.size() - 1);\n            \tscore -= num;\n            \tls.remove(ls.size() - 1);\n            } else if (s.equals("D")) {\n            \tint num = ls.get(ls.size() - 1) * 2;\n            \tscore += num;\n            \tls.add(num);\n            } else {\n            \tint num = Integer.valueOf(s);\n            \tscore += num;\n            \tls.add(num);\n            }\n        }\n        return score;\n    }\n}\n```
[]