Microsoft interview question

Design an algorithm for creating a puzzle.