Describe an algorithm which would efficiently find the minimum number of pieces

19 Views Asked by At

Let 1 = L1 < L2 < . . . < Lm be positive integers and Li is prime for i > 1. Suppose we wish to decompose a sequence of N letters into pieces (subsequences), each of length Li for some i, with the smallest number of pieces possible. Describe an algorithm which would efficiently find the minimum number of pieces. (For example, if L1 = 1, L2 = 5, and L3 = 7, and N = 10, the optimal solution would be two pieces of length 5.)