Shortest Path Algorithm Leetcode Two Sum Solution C