Leetcode Find If Path Exists In Python