Straight Forward Solution and no alternative method :)


#1
bool check(string s){
    return (s == "+" or s=="-" or s=="*" or s=="/");
}
int Solution::evalRPN(vector<string> &arr) {
    int n = arr.size(), val1, val2, res = 0;
    if(n == 0)
        return 0;
    stack<int> st;
    for(int i=0; i<n; i++){
        if(!check(arr[i]))
            st.push(stoi(arr[i]));
        else {
            val1 = st.top();
            st.pop();
            val2 = st.top();
            st.pop();
            if(arr[i] == "+")
                res = val1+val2;
            else if(arr[i] == "-")
                res = val2-val1; 
            else if(arr[i] == "*")
                res = val1*val2;
            else if(arr[i] == "/")
                res = val2/val1;
            st.push(res);
        }
    }
    return st.top();
}