Python Does Path Exists Leetcode 150 Problem