Amazon Interview Question

The only problem was: design the "fill with paint" function, for an mspaint-like program.