Pergunta de entrevista da empresa Adobe

A not-so-basic question on solving a problem using a (flood-fill) algorithm.