Python Does Path Exists Leetcode 1503