Shortest Path Algorithm Leetcode Two Sums