First, I’m not at all sure what I read is possible. Therefore, I have to assume that there is another interpretation that instructor has in mind.
Given that the maximum allowed memory is less than the total number of bits in the 32 patterns, your greatest problem is going to be designing a compression algorithm that will hold all of the data in the permitted memory. Compared to that, the rest of the design is a breeze.