Question: Shortest substring, T, that can be repeated to make String S, for example: S = aaaabaaaaaabaa T = aaaabaa amount = 2 S = aaa
Shortest substring, T, that can be repeated to make String S, for example: S = aaaabaaaaaabaa T = aaaabaa amount = 2
S = aaa T = a amount = 3
S = ababab T = ab amount = 3
S = abaaabaa T = abaa amount = 2
S = aaaabcab T = aaaabcab amount = 1 (no substring can be repeated until the end of S)
I know how to approach this by brute force, but how can I approach this with dynamic programming? An algorithm will be greatly appreciated.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
