Earn extra honor and gain new allies!
Honor is earned for each new codewarrior who joins.
Learn more
  • For Swift

    let longRoutes = [["San Policarpo", "Oras"], ["Balangiga", "Lawaan"], ["Borongan", "Maydolong"], ["Jipapad", "Maslog"], ["Balangkayan", "Llorente"], ["Mercedes", "Guiuan"], ["Taft", "Sulat"], ["Sulat", "San Julian"], ["Arteche", "San Policarpo"], ["Oras", "Dolores"], ["Dolores", "Can-avid"], ["Can-avid", "Taft"], ["San Julian", "Borongan"], ["Maydolong", "Balangkayan"], ["Llorente", "Hernani"], ["Hernani", "General MacArthur"], ["General MacArthur", "Giporlos"], ["Giporlos", "Balangiga"], ["Lawaan", "Salcedo"], ["Salcedo", "Mercedes"], ["Maslog", "Arteche"]]

    XCTAssertEqual(findRoutes(routes: longRoutes), "Jipapad, Maslog, Arteche, San Policarpo, Oras, Dolores, Can-avid, Taft, Sulat, San Julian, Borongan, Maydolong, Balangkayan, Llorente, Hernani, General MacArthur, Giporlos, Balangiga, Lawaan, Salcedo, Mercedes, Guiuan")

  • There's got to be some elegant way to do this in SWIFT! I hope some one submit that.

  • Sample Tests is not runnable.

  • I would love to see an unconstrained version of this kata (ie. Find the longest path the spy could take based on these ticket purchases)

  • Thank you for pointing this out. I may not be able to provide random tests for now. But I'll have it published with random test cases on the next iteration.

  • For your request, please see ff:

    assertEquals("Jipapad, Maslog, Arteche, San Policarpo, Oras, Dolores, Can-avid, Taft, Sulat, San Julian, Borongan, Maydolong, Balangkayan, Llorente, Hernani, General MacArthur, Giporlos, Balangiga, Lawaan, Salcedo, Mercedes, Guiuan",
              routes.findRoutes(new String[][]{{"San Policarpo", "Oras"}, {"Balangiga", "Lawaan"}, {"Borongan", "Maydolong"}, {"Jipapad", "Maslog"}, {"Balangkayan", "Llorente"}, {"Mercedes", "Guiuan"}, {"Taft", "Sulat"}, {"Sulat", "San Julian"}, {"Arteche", "San Policarpo"}, {"Oras", "Dolores"}, {"Dolores", "Can-avid"}, {"Can-avid", "Taft"}, {"San Julian", "Borongan"}, {"Maydolong", "Balangkayan"}, {"Llorente", "Hernani"}, {"Hernani", "General MacArthur"}, {"General MacArthur", "Giporlos"}, {"Giporlos", "Balangiga"}, {"Lawaan", "Salcedo"}, {"Salcedo", "Mercedes"}, {"Maslog", "Arteche"}}));
    
  • My Java code passes the sample tests, but for the actual tests I have a failing test with this error message -

    expected:<[Jipapad, Maslog, Arteche, San Policarpo, Oras, Dolores, Can-avid, Taft, Sulat], San Julian, Borong...> but was:<[Oras, Dolores, Can-avid, Taft, Sulat, Jipapad, Maslog, Arteche, San Policarpo], San Julian, Borong...>
    

    I'm not exactly sure which test case this is, but I need to see the input. Is it just the last one? If so, could you please provide the expected String and array representation of routes for this test case, as you have done for the sample tests?

    PS - I did get a print of routes but I'm not sure if this is for the failing test. For instance, I created a JUnit test manually for one of the "actual" tests and I think it produces the right result -

    assertEquals("USA, BRA, KSA, UAE, JPN, PHL",
                    routes.findRoutes(new String[][]{{"BRA", "KSA"}, {"USA", "BRA"}, {"JPN", "PHL"}, {"KSA", "UAE"}, {"UAE", "JPN"}}));
    
  • (JS, possibly others)

    Needs random tests.

    Frankly, should not have been approved without ( either the kata or the translation ).

  • Thanks. I see it now.

  • it is the order within the iteneraries which you have to follow.
    There's an itenerary ["Toronto", "Chicago"] which means Toronto comes before Chicago.
    So Chicago can't be the first.

  • I'm utterly baffled by the 2nd example. If the first itinerary is ["Chicago", "Winnipeg"], why does the expected result start with "Halifax, Montreal"?
    If the destinations are not to be listed according to itinerary order, in what order are we supposed to list them?

  • pretty hard for a 6kyu

  • Let me know what is confusing?
    And this Kata won't be posted if the test cases are failing.

  • like @SimonR mentioned, the second test case is confusing and failing in Objective C

  • This Kata should be in <4 kyu>.

  • Loading more items...