Old Top Coder riddle: Making a number by inserting +

后端 未结 6 1680
借酒劲吻你
借酒劲吻你 2021-02-06 05:41

I am thinking about this topcoder problem.

Given a string of digits, find the minimum number of additions required for the string to equal some target n

6条回答
  •  礼貌的吻别
    2021-02-06 05:55

    I think the problem is similar to Matrix Chain Multiplication problem where we have to put braces for least multiplication. Here braces represent '+'. So I think it could be solved by similar dp approach.. Will try to implement it.

提交回复
热议问题