Ad
  • Custom User Avatar

    Random tests very oftenly generates junctions with a route to itself, which should not be valid.

  • Custom User Avatar

    The cost of fuel should be calculated using the provided price. The cost of fuel is per kilometer, not per litre or gallon. To calculate the fuel cost for a 12km stretch at $0.18 per km, you should multiply 12 by 18. This should be factored into your final route calculation.

    If the price is $0.18 per km, why are we multiplying by 18?

    In fact the unit of the cost to be returned has never been specified. Is it in dollars, or cents?

  • Custom User Avatar

    If there are two paths with the same cost, choose the one with the fewest junctions

    What happens after that? This is not suffucient as a tie-breaker (as two routes with the same cost and length can exist), and the tests only accepts a single correct path.

  • Custom User Avatar

    Hi,

    • This is unfortunately a duplicate (see cheapest route, or shallowest path in the river and so on).
    • the description is very convoluted... and the specs of the inputs aren't clear. Or even concistent: the roads are given as an actual undirected graph, while the tolls are supposed to be undirected but have to be made so on the user side.
    • the random tests may provide illogical data: a toll may be provided for a road that doesn't exist. Not specified, but mostly, that shouldn't happen.
    • what module are you actually talking about...?
    • the appropriate algo here is not Dijkstra (Dijkstra implies that you're searching for all best path from one source. Here the task is "simpler")

    Imo, you should unpublish this kata. Even if you enforce the time complexity, it's still a duplicate of other already approved kata.

    Cheers

  • Default User Avatar

    This isn't a 2 kyu, maybe if we needed to use Dijkstra because of performance but not as it is.

  • Custom User Avatar

    Having the first 2 elements of the sequence is enough to find its formula; can you explain why the input arrays have up to 100 elements in them, and why the input is an array at all?

  • Custom User Avatar

    The user can modify the input.

  • Custom User Avatar

    [5, 10, 15] => '5n'

    Such cases are not tested.