This isn't homework, just an illustrative example of the sort of problem I'm trying to solve:
Suppose I had a number of pots that I wanted to paint different multi-coloured designs on, and each design involves different colours that have to be painted on in the right sequence. Some designs involve the same colour twice but because of the way the colours overlap, you can't do them both at the same time, you have to maintain the order the colours are painted on.
I am looking for an algorithm to interleave the painting operations for a number of pots so that I have to wash the brush out the least number of times, i.e. so that there are the least number of colour changes from first operation to last.
Is there a standard way to do this? I've got an aging home-grown implementation that I'm updating and I'm sure it's been done before, and better!