514. Freedom Trail | DP | Dijkstras | Google | Top-Down | Bottom-Up | Bottom-Up Optimized
Vložit
- čas přidán 7. 09. 2024
- In this video, I'll talk about how to solve Leetcode 514. Freedom Trail | DP | Dijkstras | Google | Top-Down | Bottom-Up | Bottom-Up Optimized
Let's Connect:
📱Discord (Join Community) : / discord
📝Linkedin: / aryan-mittal-0077
📸 Instagram: / ez.pz.dsa
💻 Twitter - / aryan_mittal007
🤖 Github: github.com/ary...
About Me:
I am Aryan Mittal - A Software Engineer in Goldman Sachs, Speaker, Creator & Educator. During my free time, I create programming education content on this channel & also how to use that to grow :)
✨ Hashtags ✨
#programming #Interviews #leetcode #faang #maang #datastructures #algorithms
Sorry, a lot of things happened in today's video & a lot of people came in frame too🥲🥹
NO PROBLEM BRO✨✨
The wait is over. Thanks, bro!
The behavior you exhibited is not acceptable. Please be careful to avoid repeating it in the future.
@@prashant1049-y4h lamo 😂😂
hy thanks for explaining Great job
Amazing video. Keep it up
bro how do you get time , like are you working in company also ? or you are dedicating you time to videos only ... just asking for time management.
AMAZZINNNGGGG!!! The vid was 48 minutes. But I spent 3 hours analyzing and taking notes!! Thank you Aryan, bro!!
Thanks for making complicated problem more complicated then it seems.
I mean i always suggest, not to get spooked by hard problem.
First will be not to think dynamic programming for hard problem,
Start with recursion, then memoize, and then tabulate.
Its fine, if you are getting TLE, or its below average solution.
Build a recursive solution
-> if the index is greater than key, we return 0
your helper function will look like this (String ring, String key, int pointer, int index)
index will be used for traversal for the next character in the key.
pointer indicates the current location in the ring string
assume step to be maximum.
we will put a for loop to traverse the ring. (i to ring size)
If the ring index is equal to key index,
then steps will be minimum of steps or,
abs(i-ptr),
or n- abs(i-ptr)+1+ call the recursion with pointer,index +1.
return steps at the end
at the end just create a dp, add two line code to memoize it
ys you are right
Dijkstras👏👏👏👏Thankuu bhaiya
Quick note if you're doing the space optimized version and using Java... change prevDp = curDp to prevDp = curDp.clone()
Great Explanation 👍
awesome video bhaiya
Oh my god
Thanks
maksad nahi bhulna was something personal to say
bro, please add the code solution in the description as well
why did the greedy will not work well in this problem please will you explain it
Understood
aj ke biweekly ke problem ke solution upload krna bhaiya 27-04-24 vale eke,,3rd and 4th specialy
thanks for explaining wch loop comes first ...we usually write state1 in memo as loop1 and state2 as loop 2
but here its not the case
Hi, mujhe dp vaale question bohot jada mushkil lg rhe hain. Baaki questions trees, graph isse bohot easy lgte hain but dp hi nhi samajh aati. Aryan, can you help me tell me how can I overcome this. Please reply.
practice more recursion problem so you will be easily understanding dp.
Bro dont go for longer videos for watch time you can simply explain it bhai tum over kr dete ho complicated ko or complicated kr dete ho agr simply smghaoge jyada confuse nhi kroge to apne aap views aayenge tum hr video ko lamba kichte ho or complicated krte rhte ho ig i am right if not correct me here
go and watch solution which is 15 min long and dry run on a example then code it and u rote it.
u know why does it take 40 plus min cuz he gives intution, he proves why a solution works and other not, then comes to the solution.
@@VishalKumar-lw3yh ya i already watched it and code it morever easy to understand
Because it is necessary for noob like me😅
Its easy to make a 15 min video and get more views and also he explained 4 solutions. what you want 4 approaches of dp & graph in 15 min video?