VDart Digital interview question

Flood fill leet code problem