Decode Strings (LeetCode 394) | Full solution with animations and examples | Study Algorithms

String encoding and decoding are widely used in encryption algorithms. This is often used to send encrypted messages. Hence, they make up good programming problems as well. In this particular problems you are given an encoded string, and we have to figure out the actual string. Watch the video to see a visual example of how the decoding works making it easier to follow and understand. All of this with a pseudo code.
Actual problem on LeetCode: leetcode.com/problems/decode-...
Chapters:
00:00 - Intro
00:45 - Problem statement and description
02:41 - Logic to decode the given string
05:35 - Finding an optimal solution to decode the string
10:57 - Pseudo code to decode strings
13:31 - Final Thoughts
📚 Links to topics I talk about in the video:
Brute Force Algorithmic Paradigms: • Brute Force algorithms...
What is Big O: • Big O Notation Simplif...
Stack Data Structure: • Stack Data Structure e...
Other problems on Strings: • Strings
📘 A text based explanation is available at: studyalgorithms.com
Code on Github: github.com/nikoo28/java-solut...
Test-cases on Github: github.com/nikoo28/java-solut...
📖 Reference Books:
Starting Learn to Code: amzn.to/36pU0JO
Favorite book to understand algorithms: amzn.to/39w3YLS
Favorite book for data structures: amzn.to/3oAVBTk
Get started for interview preparation: amzn.to/39ysbkJ
🔗 To see more videos like this, you can show your support on: www.buymeacoffee.com/studyalg...
🎥 My Recording Gear:
Recording Light: amzn.to/3pAqh8O
Microphone: amzn.to/2MCX7qU
Recording Camera: amzn.to/3alg9Ky
Tablet to sketch and draw: amzn.to/3pM6Bi4
Surface Pen: amzn.to/3pv6tTs
Laptop to edit videos: amzn.to/2LYpMqn
💻 Get Social 💻
Follow on Facebook at: / studyalgos
Follow on Twitter at: / studyalgorithms
Follow on Tumblr at: / studyalgos
Subscribe to RSS feeds: studyalgorithms.com/feed/
Join fan mail: eepurl.com/g9Dadv
#leetcode #programming #interview

Пікірлер: 62

  • @ananyadas3257
    @ananyadas3257 Жыл бұрын

    There is a comment issue in your pseudocode...The third condition says if there is "[". It should be "]"

  • @nikoo28

    @nikoo28

    Жыл бұрын

    Thanks for the correction. You are right.

  • @rhythmbhandari8549
    @rhythmbhandari8549 Жыл бұрын

    Your explanations were clear and easy to follow, and the animations and examples you provided really helped solidify my understanding of the problem.

  • @unknownman1
    @unknownman18 ай бұрын

    You seem like a friend with whom everyone wants to spend more time. Nice explanation btw.

  • @nikoo28

    @nikoo28

    8 ай бұрын

    this comment is full of warmth..thanks!! 😄

  • @S3aw0lf
    @S3aw0lf5 ай бұрын

    After watching the video I had to work on it myself and i finally figured the code. Thanx for the video

  • @shwetagupta8721
    @shwetagupta87215 ай бұрын

    wow nikhil, you explained so well, far better than many of the paid courses, loved your teaching skills.

  • @sonicserenity9498
    @sonicserenity94984 ай бұрын

    Hey Nikhil, Thank you Man, You explain things in very easy way, keep it up

  • @sukanyaghosh24
    @sukanyaghosh249 ай бұрын

    What an amazing explanation sir, thank you so much ❤️

  • @shachisinghal8856
    @shachisinghal88567 ай бұрын

    I smile, when i see that a Q. has been covered by you. Thank you sir.

  • @nikoo28

    @nikoo28

    6 ай бұрын

    🤗

  • @vineetkumar2899
    @vineetkumar2899 Жыл бұрын

    I am a big fan of your teaching Skills

  • @prathameshpawar985
    @prathameshpawar985 Жыл бұрын

    Your logic explaination is best , keep making such videos :)

  • @nikoo28

    @nikoo28

    Жыл бұрын

    trying my best everyday :)

  • @user-cg3tw7tj1p
    @user-cg3tw7tj1p Жыл бұрын

    You were phenomenal. Hats off sirrr!!!

  • @nikoo28

    @nikoo28

    Жыл бұрын

    thanks for your kind words

  • @TalhaTabrez7
    @TalhaTabrez75 ай бұрын

    keep up the good work!!

  • @iamnoob7593
    @iamnoob7593 Жыл бұрын

    Brilliant and Intuitve.

  • @helloworld4788
    @helloworld47882 ай бұрын

    thank u so so much for the explanation

  • @jagan2350
    @jagan2350 Жыл бұрын

    Your videos are awesome 🔥

  • @tusharrastogi7490
    @tusharrastogi7490 Жыл бұрын

    great explanation :)

  • @tanyatanya3100
    @tanyatanya3100 Жыл бұрын

    nice explanation!

  • @MrRahulmalik
    @MrRahulmalik9 ай бұрын

    you are my new fav instructor after sumeet malik, keep making more videos regularly! thanks alot.

  • @nikoo28

    @nikoo28

    8 ай бұрын

    so happy you feel this way

  • @abhaykumarsingh3884
    @abhaykumarsingh38842 ай бұрын

    Very good explanation..

  • @pratibhaverma2063
    @pratibhaverma20636 ай бұрын

    Thank you sir.Very handy approch and explanation.

  • @nikoo28

    @nikoo28

    5 ай бұрын

    You are welcome

  • @lalanabiridi8358
    @lalanabiridi83588 ай бұрын

    this man is a goat

  • @subee128
    @subee1287 ай бұрын

    Thank you

  • @thanhnguyenduy78
    @thanhnguyenduy78 Жыл бұрын

    nice!!!!!!!!!

  • @dampdigits.69
    @dampdigits.696 ай бұрын

    thanks

  • @11shivamAhir00
    @11shivamAhir00 Жыл бұрын

    thanks sir

  • @user-ry8gz4om4e
    @user-ry8gz4om4e10 ай бұрын

    you are osm thank you

  • @ousmanbah10
    @ousmanbah10Ай бұрын

    best explanations

  • @nikoo28

    @nikoo28

    Ай бұрын

    Keep watching

  • @prasannavenkkatesh1192
    @prasannavenkkatesh11922 ай бұрын

    do we need 2 stacks?

  • @motivationalquotes8545
    @motivationalquotes85459 ай бұрын

    Very well explained I don't understand why their is less like to video

  • @nikoo28

    @nikoo28

    9 ай бұрын

    i dunno either 😂

  • @shubhammanecr7
    @shubhammanecr76 ай бұрын

    Commendable explanation sir!! I just can say one line - Why fear when Nikhil Lohia is here.

  • @nikoo28

    @nikoo28

    5 ай бұрын

    🤘

  • @MsProtestante
    @MsProtestante Жыл бұрын

    Hi! Congrats for your solution! I am struggling to understand this bit of code k = (k * 10) + (c - '0') I print line by line with SYSO but I'm still no able to get it. When printing I get the following : when k = 1 (k * 10): 10 (c - '0'): 1 this is k: 1 Why k = (k * 10) + (c - '0') ends up with 1? As (k * 10) = 10 and (c - '0')= 1 why k is not 11? Could you please kindly clarify it?

  • @nikoo28

    @nikoo28

    Жыл бұрын

    The value of k = 0, not 1. :) Also when we push in the stack, once again we change it to 0.

  • @atharvdeshmukh8192
    @atharvdeshmukh81928 ай бұрын

    how to handle multidigit number?

  • @nikoo28

    @nikoo28

    7 ай бұрын

    the solution handles a multi-digit number, check the github link in description :)

  • @acxd
    @acxd Жыл бұрын

    can you do it using 1 stack!

  • @iamnoob7593

    @iamnoob7593

    Жыл бұрын

    The solution here is more intutive. I would prefer using 2 stacks.

  • @deepakffyt2844
    @deepakffyt2844 Жыл бұрын

    Abhi awaj bahut slow aaa rahi

  • @sakibx0218
    @sakibx02183 ай бұрын

    Why we need to add another stack. Since get got first bracket that means if you say stack.peek() you will get the value. Its just waste of memory

  • @nikoo28

    @nikoo28

    3 ай бұрын

    The space complexity still remains the same O(n)

  • @phucphamthanh642
    @phucphamthanh642 Жыл бұрын

    This solution doesn't work if the integer has more than one digit. e.g: 11[ab2[c]de].

  • @nikoo28

    @nikoo28

    Жыл бұрын

    It will work..for your test case the output will be abccdeabccdeabccdeabccdeabccdeabccdeabccdeabccdeabccdeabccdeabccde

  • @kolawoleabdulrahman

    @kolawoleabdulrahman

    9 ай бұрын

    it doesn't work for me as well.

  • @ArunKumar-yq9rs
    @ArunKumar-yq9rs12 күн бұрын

    100[leetcode] what will this give ;)0)

  • @ridj41
    @ridj41Ай бұрын

    the code is very complex and is not easy to understand after watching this video tbh, might have made the soln just like the code

  • @abhishekthakur7578
    @abhishekthakur7578 Жыл бұрын

    bhai isse accha toh mike mat he laga

  • @nikoo28

    @nikoo28

    Жыл бұрын

    Fixed those issues in my latest videos…thanks for the feedback :)

  • @kuldeepdiwakar1506
    @kuldeepdiwakar15067 ай бұрын

    Explanation is too simple

  • @ramnarayan2556
    @ramnarayan255610 ай бұрын

    Bro try to speak loudly

  • @nikoo28

    @nikoo28

    9 ай бұрын

    check my latest videos, if you still find the issue

  • @tech-red24
    @tech-red244 ай бұрын

    bha sound quality bhtttttttttttttttttttttttttt hi gandiiii h ...mic cgange kro phle to aap