6 kyu

Next Version

973 of 2,100AzariasB
Description
Loading description...
Arrays
Strings
Algorithms
  • Please sign in or sign up to leave a comment.
  • Xros22 Avatar

    several very different ways to do this one. Some choose to treat the version as a number, and then build from there, while others clearly focus on managing it as an iterable. nice little exercise

  • ahmet_popaj Avatar

    Nice one, well done kata.

  • Blind4Basics Avatar

    Python new test framework should be used

    warning, the assertions must be inside a it block, not a describe one (fixed tests). It works both ways, but for further compatibilty, the wrapping it is prefered.

  • ejini战神 Avatar

    Missing return type in initial solution setup of TS

  • ejini战神 Avatar

    Python new test framework should be used

  • ejini战神 Avatar

    Ruby function name should be snake_case

  • ejini战神 Avatar

    Description should be language-agnostic

  • farhanaditya Avatar

    JS: Node v12 should be used along with its appropiate assertion tools (Mocha + Chai). Refer to this and this

  • mjsspencer Avatar

    Literally laughed out loud when I saw the solutions, the one thing I didn't try because it never occurred to me that the kata could be so easy.

  • Lightman47 Avatar

    Oh it was hard for me... 1:30 hour for this kata :D

    console.log('Nice Kata')

  • PaulH74 Avatar

    For Python:

    Can the author (or anybody) please advise why this test fails:

    '2.9.7.6.6.9.8.2.7.8.0.4.0.7.7.9.8.5' should equal '0.2.9.7.6.6.9.8.2.7.8.0.4.0.7.7.9.8.5'

    Why is a "0." being appended to the start of the string in this case?

  • gulewski Avatar

    For Python some tests are incorrect:

    '1.1' should equal '11' '1.1.0.0.0.0.0' should equal '11.0.0.0.0.0' '10.0.0' should equal '100.0' '10.0.0.0' should equal '1000.0'

  • Cussc Avatar

    The author should take a look at the TDD: random test a: ".7.9.8.1.3.2.7.1.3.7.4.6.6" should equal "0.0.7.9.8.1.3.2.7.1.3.7.4.6.6" random test b: ".7.7.1.3.7" should equal "0.7.7.1.3.7"

    its not possible to derive a deterministic logic for such errors

  • LinuxUser404 Avatar

    The authors solution is incorrect. It reverses the input if it does not contain dots... So authors solution treats strings "123" as "321", examples from other comments: "34" becomes "43", then "44" instead of correct "35" "76" becomes "67", then "68" instead of correct "77"

    I have both correct and bugged solutions for this problem. So if there is someone, who can correct the kata you can use mine to fix it.

  • fr-ser Avatar

    One example in the description is misleading (just a typo):

    nextVersion("0.9.9") === "1.0.0.";

    There should be no "dot" at the end

  • Darshan97 Avatar

    Nice Kata :D

  • zebulan Avatar

    @AzariasB,

    Python 3 is unavailable. This can be fixed by changing both occurrences of xrange to range.

    Thanks!

  • kazk Avatar

    Some random test cases in Haskell expects wrong values.

    Example:

    works with random (valid) version numbers
      ✘ Falsifiable (after 48 tests): 
        expected: "44"
         but got: "35"
        Version {unVersion = "34"}
    

    unVersion matches the input I inspected with Debug.Trace.trace, so the reference solution seems to expect nextVersion "34" == "44". The only explanation I can think of is that it's reversing the input (34 -> 43) for some reason and incrementing that (43 -> 44). Another example was nextVersion "76" == "68".

    edit: Just noticed this unlabeled comment from 3 months ago mentioning the problem.

  • MMMAAANNN Avatar

    This statement in description is wrong:

    All numbers, except the first one, must not be greater than 10:

    It implies that numbers can be equal to 10 (equal to 10 is not greater than 10). I suggest to change wording to "must be lower than 10".

    Also, I think there is an important corner case missing of something like 99.9.9.9.9. My broken solution passed while it shouldn't have passed for this case.

  • user5036852 Avatar

    TypeScript-Translation kumited!

    https://www.codewars.com/kumite/5810c7ed6ffab5f4720001a4

    Please check and approve it. ;-)

  • user5036852 Avatar

    Great kata. Thanks.

  • rodolv1979 Avatar

    This comment has been hidden.

  • MrStorm Avatar

    There is an issue with the Haskell validator. It expects a result different from the correct one, as you can see in the error message:

    Falsifiable (after 19 tests): expected: "95" but got: "50" Version {unVersion = "49"}

  • Beast Avatar

    Great kata! Thanks for the 2 points. Very satisfied.

  • ritu_d Avatar

    "...if there are, you have to set it to 0 and increment the next version number."

    Will you please give an example of this?

  • matt c Avatar

    Approved :)

  • pioraid Avatar

    This comment has been hidden.

  • pioraid Avatar

    AzariasB, at this point we're the only two to have solved this. The details pave shows that there's only been one vote for this kata being ready (mine). Are you allowed to vote on your own kata?

    This was a fun one. Didn't take too much effort to figure out. Just to screw with people you could throw them version numbers that need to be normalised like 1.2.11.19.38 which would come out to 1.3.3.2.9 if I'm correct.

    I gave it a 6-kyu. Based on the descriptions I think it's obviously over a 7. I could easily see this being a 5-kyu as well based on the descriptions.