5 kyu

The Spider and the Fly

79 of 114dinglemouse
Description
Loading description...
Debugging
Algorithms
  • Please sign in or sign up to leave a comment.
  • trashy_incel Avatar

    the Debugging tag seems inappropriate

  • saudiGuy Avatar
  • charliearaya Avatar

    Can anyone explain to me why the answer is not H3-G3-F3-E3-E2? If every step is worth 1?

  • Maxim_Godov Avatar

    I really enjoyed this Kata.

  • RealKenshiro Avatar

    An excellent and original Kata (but hard to debug with so many edge cases ...)

  • dfhwze Avatar

    C# reference solution uses bad practice string + string:

    answer += $"{sr}{sl}-"

    Use a StringBuilder instead.

  • dfhwze Avatar

    C# tests should have custom error message. Replace the Console logging with an error message in the assert.

    Console.WriteLine($"Random test #{r + 1}: spider={spider}, fly={fly} => path={expected}");
    Assert.AreEqual(expected, actual);  // -> Assert.AreEqual(expected, actual, $"Random test #{r + 1}: spider={spider}, fly={fly} => path={expected});
    
  • dfhwze Avatar

    What time complexity is required in C#, I get a timeout all the time, eventhough my solution is O(n), I don't use any backtracking.

    Even the sample tests take way too much time -> Time: 3134msPassed: 3Failed: 0. These 3 test cases pass in less than 100 msec. -> why 3 seconds total time? Is this a kata issue?

  • user1326445 Avatar

    For people like me who skim through descriptions the picture can give wrong impression that web is made from isosceles triangles rather than circles (only to later notice the keyword radial which unlike the picture is hardly noticeable), so updating picture to reflect that would be helpful.

  • KataSideKick Avatar

    C# Translation added.Please review and approve~

  • z_w Avatar

    This kata is weird. However I've made a bunch of tests and figured out a pretty easy solution.

  • Jomopipi Avatar

    thank you for this kata! hope you enjoy my solution

  • yixiu Avatar

    if spider or fly was "A0",output tell me that "expected:<A[0-A]1-A2-A3-A4> but was:<A[]1-A2-A3"-A4>" but I don't konw why the result was A0-A1-A2-A3-A4 when I use Eclipse.

  • SpaceBison Avatar

    I would suggest that the metric by which a path is measured should be included in the description. At the moment, one could assume that all the edges have equal lengths/weights.

  • cassi.emerson Avatar

    I think I may be misunderstanding. In the scenario presented, wouldn't the shortest path be H3-G3-F3-E3-E2 ? Is there something I am missing on why he wouldn't go this path?

  • Voile Avatar

    Approved ;-)

  • Voile Avatar

    This comment has been hidden.

  • dinglemouse Avatar

    This Kata has bugs in it