Consider a set of patterns P={P1, P2, ...Pk}, where each pattern Pi is a string with cost ci>0. For a given string S, how to divide S into sub-strings such that each substring is a pattern from P and the total cost is minimized?
How can I design an algorithm for dynamic programming for this question, that I was asked in an interview?
Any suggestions would be really helpful
Aucun commentaire:
Enregistrer un commentaire