Short Palindrome Discussions | Algorithms | HackerRank
We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I recently brushed up my knowledge about graph theory (last time was like 5 years ago during my college years). However, I might be confused about one or two things. In the first test case given as an example:
2
4 2
1 2
1 3
To me it seems like we can have the topology below:
3 - 1 - 2 - 4
But it's indicated that the distance from vertex 1(S) to vertex 4 (D) is infinity.
I cannot get my head around that, why is it supposed to be infinity while to me it is sound that is 2 edges leading then to a distance of 12?
I assume that I have a pretty big misconception, in what infinity is shorter distance than say, 12?
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Short Palindrome
You are viewing a single comment's thread. Return to all comments →
I recently brushed up my knowledge about graph theory (last time was like 5 years ago during my college years). However, I might be confused about one or two things. In the first test case given as an example:
To me it seems like we can have the topology below:
But it's indicated that the distance from vertex 1(S) to vertex 4 (D) is infinity.
I cannot get my head around that, why is it supposed to be infinity while to me it is sound that is 2 edges leading then to a distance of 12? I assume that I have a pretty big misconception, in what infinity is shorter distance than say, 12?