5 kyu

Grab CSV Columns

526 of 1,164xDranik
Description
Loading description...
Strings
Algorithms
View
AllIssues5QuestionsSuggestions2Show Resolved
  • Please sign in or sign up to leave a comment.
  • ahmet_popaj Avatar

    Nice one, well done.

  • ejini战神 Avatar
    • Description should be language-agnostic

    • Does not mention the output format when mapping to a non-existent column (giving examples without explanation is a "no-no")

  • ejini战神 Avatar

    CS:

    • No random tests

    • Using Test.expect

  • mdg Avatar

    Even your code is right the test doesn't pass.

  • meni181818 Avatar

    C translation. author inactive.

  • user9644768 Avatar

    No random tests. assertEquals should be used.

  • FArekkusu Avatar

    It is not mentioned that the keys have to be unique and sorted.

  • melcus Avatar

    So I have all the normal cases working and I also solved a case with a repeated indice, but now in the random tests I am seeing cases where the expected result is the reverse of what I generate, or the second and third elements are swapped or, everything is shifted to the left or right, are these the special cases people are talking about? and can anyone give me a hint on the reason for the different cases, I'm sure there must be a pattern but I'm not seeing anything in the numbers?

  • Gwiji Avatar

    I stopped working on this days ago thinking i was doing something wrong only to realize today that the instructions were insufficient. Nice kata but you should have let us know all the corner cases to expect.

  • odedr Avatar

    I get the expected results but some tests still fail. tried trim() but still doesnt pass.

  • Blind4Basics Avatar

    As it is said below, the tests cases are overdetermined compared to the description.

    The hidden conditions are interesting, but they have to be plainly explained ! To not considere it as an issue (that I almost used to post this comment...), the kata should at least be tagged with puzzle or it should be explicitly said that there might be some undescribed behaviours to take care of, outisde of the scope of the sample tests.

  • ebbruns Avatar

    This comment has been hidden.

  • SimplGy Avatar

    Please use assertEquals. This way instead of the message "Expected ''" We get something helpful, like "Expected '', got 17". :)

  • LeatherGreenGargoyle Avatar

    This comment has been hidden.

  • GiacomoSorbi Avatar

    Nice kata; translated into both Ruby and Python and I would gladly add some more (and random) tests to the JS version, if the author is ok with it :)

  • jamietre Avatar

    The solutions to this kata are interesting because they highlight how you can write more terse but less efficient code. The most upvoted solutions to this problem all skip the step of optimizing the column map up front, and instead use indexOf to test each column against the map on each iteration - very inefficient. Optimizing the map first to create a valid lookup table is a superior approach, even if it's a few more lines of code and means you can't solve it in a single statement.

    This is not a criticism of the kata at all but sort of an observation that codewars users seem to prefer short/"clever" solutions to more efficient ones. I wonder if there's some way to develop katas that can build the notion of good algorithmic design vs. just typing the least into the solution.

  • mattbache Avatar

    This comment has been hidden.

  • wayneamanselle Avatar

    This comment has been hidden.