DP 33. Edit Distance | Recursive to 1D Array Optimised Solution 🔥

preview_player
Показать описание

a

In this video, we solve the Edit Distance problem.

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

Hey Striver, I got this question in my Microsoft Internship Interview today, without your video I would never have solved this question so perfectly, the interviewer is indeed amazed by the space optimization that I did! Thank you so much!

Anonymous-ujjx
Автор

Method 1)-- recursion
i=str1_hourse || intention, j=str2_ros || extention ()
1.1)
13:37 insert operation
15:24 delete operation
16:41 replace operation
1.2)
min
1.3)
Base case 17:58

s1 exeusted 18:52 (min op to convert str1 to str2 (j+1))
s2 exeusted 20:56 (min op to convert str1 to str2_khali dusri (i+1))

1.4) space O(N+M)
and time complexity (exponential e^x) 22:05

Method 2)-- recursion memoisation 23:21 + tc & sc 23:30

2.1)-- to reduce oxillary stack space present in rec_memo we use tabulation

Method 2)---tabulation &
space optimisation

2.1) 26:58 to 28:35 one based indexing (slight change)

2.2) base case 29:24
2.3) I j ( bottom up= tabulation) 30:40
2.4) copy the recurrence
2.5)Code - 31:06

*2.6) space opt---33:16

2.7)concept of space optimasation 33:48

2.8)Code

karanthakur
Автор

After 33 lecs, 90% effort is for recursion 10% effort for memo, tabulation.space opti.
if u master recursion all the next 3 things are piece of cake.

RaghavSharma-nthr
Автор

I’m following the DP play list from the beginning. What an amazing way to deliver content, I’m really amazed to see clarity in the steps thought. Thank you sooo much :)

pavannettam
Автор

Hey striver,
I was able to do it myself and all the credit goes to you and aditya Verma!
Thanks a lot

amancuber
Автор

I've gotta say, your way of teaching is pretty awesome. I haven't come across any other YouTuber breaking down tricky stuff like you do. It's obvious you've put in a ton of work to make things easy to understand 💯

_Kunal_Pawar
Автор

Today is 4th September
Tomorrow is 5th september which is teacher's day,
And I want to thank this amazing teacher of ours.
Thankyou Raj
Thankyou Striver
You're one of the best teachers I have got in my life.

parthh
Автор

Hey Striver, I got the space optimization logic in the first time without looking at solution and wrong answer. All thanks to you man!

anuragpandey
Автор

first it seemed extremely complicated, but towards the end as it unfolded, it was very clear.. u r an amazing teacher..

shantipriya
Автор

Hey striver i'm from west bengal, i am currently start learning dp and the way you define i am really satisfied its become challenging to me all the steps, but i'm trying. thank you for such helpful playlist on dp with such elaboration.😀😀😀😀😀

shubhangkarsaha
Автор

Initially I thought I won't be able to solve this question by myself, but I spent some time on it, thought about the different possible cases, and got the solution on my own. Your videos are just amazing !!

suhasherle
Автор

After so many lectures it is clear that the hardest part is to figure out the recursion. After that memoization, tabulation and space optimization is a piece of cake.

sarthakyadav
Автор

Written Space Optimised Solution without Watching this Video This show the level of concept your previous videos built. Thanks ✨💯

ankitpandey
Автор

What a wonderful person you are. I solved this problem without viewing the video because of your previous videos

namangarg
Автор

Hey Striver, Man ur videos are just superbly fantastic. I knew only how to recursion + memo dp for the past 2years, But i did not know Bottom up dp. I could not clear online test rounds due to TLE. Now after watching ur videos in dp bottom up/recursion approaches . I got some hope that i can crack interviews in product based.

iamnoob
Автор

This is a cream question guys. Understand it very clearly. If you understand you are probably good with DP on strings.

rushidesai
Автор

The key thing to understand is that we don't ACTUALLY have to insert, delete or replace.. we only have to count the operations. This kind of observation may seem dumb at first glance, but when approaching this problem (or similar problems) myself, this is the major thing that causes a mind block and keeps me from getting to the solution.
Great video!!🙏

InWonderland-zl
Автор

Jus
best explanation of edit distnce ever
explained all cases with such elegance and clarity 🙏🙏

sasageyo
Автор

understood, and i'll like to mention that till today i was a bit confused abt the working of 2 arrays space optimisation, but after dry run, it got absolutely clear.
thanks for this whole DP series, enjoying it too much.

Parthj
Автор

You explain in such a way even a kid who do not know any thing related this, will understand😄.
Amazing video, definitely understood.

sahilbadkul