Amazon Interview Question

Flood fill problem