Lutron Electronics Interview Question

(continuing Q2) Then we'd also want to have a redo() method. Implement this!

Interview Answer

Anonymous

Mar 10, 2011

I used another stack. If an undo() is called, pop that from undo stack, create a new object which holds undo's method and current value, and push that into redo stack. And then revert the rectangle's value into what was in undo's stack. Remember to clear out redo stack after you undo something and call a new method!

1