All Pair Shortest Path Leetcode Javascript Question