Microsoft Interview Question

Design an algorithm for creating a puzzle.