Amazon Interview Question

write a method which takes x/y coordinates for a point for a graphics program and implement a bucket-fill (change all the surrounding pixels of the same color to the new color)

Interview Answer

Anonymous

Aug 20, 2010

I wasn't expecting something like this, but I came up with a recursive algorithm which took a point, changed the color if it matched, and called the same method (recursively) for all neighboring points.