veky
on Aug. 25, 2013, 2:54 p.m.
<p>Nice and straightforward. But Dijkstra is massive overkill. The point is, there are only two paths (+ degenerate case) you have to explore. See my solution, I can write it in long form if you need.</p>

gyahun_dash
on May 25, 2014, 5:28 a.m.
<blockquote>
<p>The point is, there are only two paths (+ degenerate case) you have to explore.</p>
</blockquote>
<p>Reading your comment, I've found <a href="http://www.checkio.org/mission/water-jars/publications/gyahun_dash/python-3/first/">the way to select a better path from the two</a>. Thanks!</p>

PositronicLlama
on Aug. 25, 2013, 4:23 p.m.
<p>Good point. I like your solution, and it's about 2-6 times faster than mine, depending on the test case. That said, my solution would be easier to extend to any number of jars (or other modifications to the problem space), and mine also has better documentation!</p>

veky
on Aug. 25, 2013, 7:04 p.m.
<p>Ah, documentation, schmocumentation. I'm up to my ears in documentation. But here you are. :-)</p>
<p>About generalization, I concede that. But I just wanted to point out this case has a much simpler solution than what usually comes to mind.</p>