Блог пользователя m0ew

Автор m0ew, история, 6 лет назад, По-английски

Hi everyone, This is my first post.I was trying to solve the Road Cutting problem on interviewbit.com.

Here is the problem link — https://www.interviewbit.com/problems/rod-cutting/

I read the editorial as well but i wasn't able to understand it. Detailed approach to this problem is appreciated.

Thanks in advance!

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
6 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Pretty standard dp problem. Try reading about optimal binary search tree. The recurrence for that problem is similar to this one.

»
6 лет назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

I think this youtube video might help https://www.youtube.com/watch?v=IRwVmTmN6go

»
6 лет назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

Struggling with this type of problem for the first time is totally ok. I'm giving you a few resources that can help you. First of all, this problem can be solved easily with dynamic programming, so you have to read and understand dynamic programming properly. This problem falls under a classic dynamic programming section named matrix chain multiplication.

  1. https://www.topcoder.com/community/data-science/data-science-tutorials/dynamic-programming-from-novice-to-advanced/
  2. https://www.geeksforgeeks.org/matrix-chain-multiplication-dp-8/
  3. https://www.youtube.com/watch?v=vgLJZMUfnsU
  • »
    »
    6 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Thank for the list of resources, I will follow them one by one. Also, may I know, in which attempt you solved this question?

    • »
      »
      »
      6 лет назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      It was a very familiar problem to me because I solve many problems on MCM dp ( matrix chain multiplication). So this time no significant time needed (Don't get frustrated seeing this, if you practice enough you will feel the same)

»
6 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Easier dp. quite similar Uva problem: 10003.

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Can this be solved using greedy?