12:06
Ok, I couldn't try working it out by hand - didn't get time. I'll try that soon and get back. However, I came across another problem and this was in a contest. This clearly is a DP problem and I came up with a solution too (and only then I realised I understood DP!). I would however prefer it getting 'approved' by you! I think it is right, though can't say it with surety.
3. You can chuck off the middle char temporarily and shift the adjacent 3 (on the left) towards right.
4. You can chuck off the middle char temporarily and shift the adjacent 3 (on the right) towards left.
The question is to find the minimum number of steps required to convert a given string to "1234567".
I just somehow conjectured (and not proved) that whenever we apply a transformation, we must get 'towards' the string "1234567" and our 'closeness' can be measured in terms of 'breaks' we have in the string.
1 hour later…
« first day (4 days earlier) ← previous day next day → last day (17 days later) »
Transcript for
Jul24
Jul '1328
Jul29
Dynamic Programming and Greedy Algori…
A discussion on difference between the two