Solve flood fill exercise.