Evaluate Reverse Polish Notation | Leetcode Example Stack in Data structure & Algorithms Hello World

preview_player
Показать описание
This is the video under the series of DATA STRUCTURE & ALGORITHM in a STACK Playlist. Now we are going to solve the Problem of Evaluate Reverse Polish Notation From Leetcode in the stacked series.

----------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------

*Follow me *

----------------------------------------------------------------------------------------

►Our Playlists on:-

------------------------------------------------------------------------

🌟 Please leave a LIKE ❤️ and SUBSCRIBE for more AMAZING content! 🌟

✨ Tags ✨
leetcode problems
leetcode problems java
leetcode problems python
leetcode problems that got me tired
leetcode problems c++
leetcode problems and solutions python
leetcode problems js
stack practice problems
stack practice problems gfg
leetcode stack questions
leetcode stack queue
stack hello world
question asked in Google
off-campus placement
evaluation of postfix expression using stack
Evaluate Reverse Polish Notation
infix prefix and postfix expressions
Practice stack data structure
Stack in a data structure in Hindi
Stack Full playlist for Beginners
placement in 3 months
algorithms
graph DSA
data structure
sorting algorithms
time-complexity analysis
gate computer science preparation
programming languages

#stack #Leetcode #programming
Рекомендации по теме
Комментарии
Автор

Bhaiya we can also use "st.push(stoi(tokens[i]))" in else condition instead of using stringstream and thanks for this playlist

shaxuryaa
Автор

We ll have to use long long int otherwise on multiplying operands it will overflow

sarthakkhare
Автор

nice video.... string se integer me stoi() function se bhi kar sakte hai....

sus_tha_coder
Автор

Bro is this playlist is completed or u going to upload more?? ❤️❤️By The way Bro I Love yo

ManishSingh-vryj
Автор

i solved this question before watching this video. by the previous video.

vivek
Автор

Done by own, using stoi( );
int evalRPN(vector<string>& tokens) {
stack<int> st;
for (auto x : tokens){
if (x == "+" or x == "-" or x == "*" or x == "/"){
int op1 = st.top();
st.pop();
int op2 = st.top();
st.pop();
if (x == "+"){
st.push(op2 + op1);
}
else if (x == "-"){
st.push(op2 - op1);
}
else if (x == "*"){
st.push(op2 * op1);
}
else if (x == "/"){
st.push(op2 / op1);
}
}
else {
int num = stoi(x);
st.push(num);
}
}
return st.top();
}

pritishpattnaik
Автор

Done Without watching solution but it's brute force... 😅😅

samridhrana
Автор

It's not working for testcase -["-128", "-128", "*", "-128", "*", "-128", "*", "8", "*", "-1", "*"]
so program is not submited

aceyourdreams
welcome to shbcf.ru