Shortest Path Problem Leetcode Sql