Decode String 🔥 | Leetcode 394 | Stack

preview_player
Показать описание
Timestamps:
Problem discussion: 02:42
Approaching the problem: 02:43
Dry Run: 04:46
Code Explanation: 15:11
Time Complexity: 17:05

Time Complexity : O(n)
Space Complexity : O(n)


Please like, share and subscribe if you found the video useful. Feel free to ask in comments section if you have any doubts. :)

#DataStructuresAndAlgorithms
#Leetcode
#interviewpreparation
Decode String solution
Decode String Leetcode
Decode String C++
Decode String Java
Decode String Python

🔥🔥🔥🔥👇👇👇

Checkout the series: 🔥🔥🔥
LIKE | SHARE | SUBSCRIBE 🔥🔥😊
Рекомендации по теме
Комментарии
Автор

Best approach and explanation on the youtube to decode string.

anubhv
Автор

way of explanation is awesome.
clear voice.
THANK U VERY MUCH

f-..
Автор

The best explanation in the entire youtube...THANKS.

gautamjangir
Автор

Very easily understood, amazing explanation skills . Thankyou, keep contributing :)

gyanprakash
Автор

wow great Ayushi.
you have great skill to explain precisely and making complex things easy.
thanks a ton.

spardha-yug
Автор

Easy explanation, thank you for contributing!

ninadkheratkar
Автор

So easy relevant and wonderful explanation. Great Teaching!! :)

lifekool
Автор

Thank you for the amazing explanation :)

gandhijainamgunvantkumar
Автор

Please tell the time and space complexity as well with the logic thatg would be great help

relaxingwithnaturebeauty
Автор

Nice coding skills and explaination in such a young age.😊

meditationmusic
Автор

C++ Code Below:-
class Solution {
public:
string decodeString(string s) {
stack<int>numStack;
stack<string> strStack;
int currNum = 0;
string currString = "";
for(auto c : s)
{
if(c == '[')
{
strStack.push(currString);
numStack.push(currNum);
currNum = 0;
currString = "";
}
else if(c == ']')
{
int num = numStack.top();
numStack.pop();
string output = "";
while(num--)
{
output += currString;
}
string prevString = strStack.top();
strStack.pop();
currString = prevString + output;
}
else if (isdigit(c))
{
currNum = currNum * 10 + (c - '0');
}
else
{
currString += c;
}
}
return currString;
}
};

Gaurav-fbds
Автор

hello didi i am second year non cs student can you suggest me a book for c++ for clearnig my fundamentals and basics of a c++ programming language so after that i can DS algo and i am totally new to programming field

sangamsharma
Автор

Great Video I have sent the request over linkedin but you didnt except it can you please provide your referral for SDE -3

shulabhkumar
Автор

Mam aap coding Sikhana bhi start kr do please

smnema
Автор

Mam were you able to come up with this approach in your first attempt
OR you had also learned this approach from somewhere, ,,asking because i have done many ques.. on stack but got stuck at this problem
hope you would reply....

krishnaradhey
Автор

I always look for your videos for a problem and if its not there then only I go for others channel😅

krishnasai
Автор

awsm and plz upload video in python plzz my request!!

Rishabhsingh-evii
Автор

I don't think this will work for nested brackets

vizthakur
Автор

I have checked your channel for this video just a hour ago 🙂. Thanks for uploading

yashsharma
Автор

maam which application is using for the explanation ?

basimk