4 ms·
Your kung fu is better than the kid in the article. How did discover that splitting the trip was cheaper?
by spikels 11y ago
Your kung fu is better than the kid in the article. How did discover that splitting the trip was cheaper?
- CarolineW 11y agoLook up the journey from SHF to SNF, look at all the stations the trains call at, download the fares splitting at each station, add the fares. It's about 10 minutes to do by hand, if you did it a lot then you could easily script it. You can get the train times and fares with a curl on the NRE web site, parse with regex (never do that, but in this case it's a trivial hack - fix it later with your favorite "proper" parser), then look at all the combinations. I imagine Dijkstra would be quick, but it's quick enough just to do a DFS through the combinations.