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.
Roads and Libraries
Roads and Libraries
Sort by
recency
|
862 Discussions
|
Please Login in order to post a comment
My Golang solution:
Does anyone know why the “Sample Test Case #2” came up with a minimum cost of 15? I got a smaller value of 9.
The cities and roads configuration is:
A library for 6 at city #1 and a road, at the cost of 1, to cities #2, #3, and #4; totaling 9.
How did they get 15?
Here's in JS, with added comments and descriptive variable names to assist.
The shortest solution I was able to create:
Mine passes 0, 1, 2, 7, 11, 12. The rest test cases with a huge input FAIL with wrong output. Not the time limit exceed. Could anyone provide a hint what I might be missing? Much appreciated! Thanks