Amazon Interview Question

Leetcode 130 Surrounded regions graph problem