Pregunta de entrevista de Algotec

there is a paint program, how do you implement a undo method?