Class count{public int Count (String a) {int n = a.length (); int result = 0;int num = 0;int p = 0;int L1 = A.indexof (' ('); int R1 = A.indexof (') '); String B = a.substring (l1+1,r1-1); int op = 0;if (L1 >= 0) return Count (b) + Result;else {for (int i=0; i < n; i++) {if (' 0 ' < (A.charat (i)) && (A.charat (i)) < ' 9 ') num = Num*10+num;switch (OP) {case 0:break;case 1:num = num + p; b Reak;case 2:num = P-num; break;default:break;} if (A.charat (i) = = ' + ') op = 1;else if (A.charat (i) = = '-') op = 2; elseop = 0;p = num;} result = Num;return result;}}} This bird thing with iteration, in fact, not very good waste of space, more data is also easy to die, someone with a stack has not been studied
This one's 600mm, and it's not clear.
Https://leetcode.com/discuss/39454/accepted-infix-postfix-based-solution-explaination-600ms
Java solution (Basic Calculator) Not yet tested, go back to book at night