로딩
요청 처리 중입니다...

JAVA_LeetCode 150_Evaluate Reverse Polish Notation

 JAVA_LeetCode 150_Evaluate Reverse Polish Notation

JAVA_LeetCode 150_Evaluate Reverse Polish Notation 풀이 class Solution { public int evalRPN(String[] tokens) { Stack stack = new Stack(); for(String token : tokens){ if(token.equals("+")) stack.push(stack.pop() + stack.pop()); else if(token.equals("*")) stack.push(stack.pop() * stack.pop()); else if(token.equals("-")){ int temp = stack.pop(); stack.push(stack.pop() - temp); }else if(token.equals("/")){ int temp = stack.pop(); stack.push(stack.pop() / temp); }else stack.push(Integer.pars...