Implement Shortest Path Leetcode Sql 50