Ad
  • Custom User Avatar
  • Default User Avatar

    Correct me if I am wrong: the String.split will find the pattern, remove it and keep left and right side.
    So every 2 chars, split will remove pattern, keep left side (just got removed) and right side.
    The trick here is that thanks to the capturing groups (?<=) + \G, pattern is reinserted(?) or pattern becomes "what's in between 2 chars" (?).
    Still trying to figure it out.

  • Default User Avatar

    "Once one knows the language" Thats the entire reason why i do these. First I solve them just making it work (Python), and then i look at the solutions of the pros and feel like an idiot, but it gives me real world exapmles of how to actually use the conventions of the language versus trying to do everything the way id have done it in another language. And I dont have to try and create code for a useless program and not have any idea if I could have done it more efficiently. Idk if that makes sense.

  • Default User Avatar
    • ranks cannot be changed
    • old katas are generally overanked
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Hey,

    There is a similar kata to this one, which is ranked 4 kyu, which asks for a harder task to convert back from the roman to the arabic dates. It might be worth adding link to it. Thanks.

  • Custom User Avatar

    I learned a lot about leaps years thanks to suggestions. As long as one considers the Proleptic Gregorian callendar, the formula is still correct. Therefore, I agree it should be added in the descritpion.

  • Custom User Avatar

    Java Translation is ready to check.

  • Custom User Avatar

    I see, I'll change all the messages. And thanks for pointing at the IntXXX specific implementations.

    I decided to put all tests in one method. This way all groups are executed sequentially. I wanted random tests to get executed only if all fixed tests get passed.

  • Default User Avatar

    There are special Function and Stream implementations for int:

    • Stream<Integer> --> IntStream
    • Function<Integer, Integer> --> IntUnaryOperator
    • Predicate<Integer> --> IntPredicate

    The assertion message should specify exactly which year failed the test and not a general "Your function gave a wrong result on one of the inputs." So do the assertion directly where you check the solution for a single input and not assertTrue(allMatch().

  • Custom User Avatar

    Thanks. I can't do that now but I'll add random tests ASAP.

    EDIT. This is my first translation, so I hope I have understood the concept and added correct random tests. Thanks.

  • Default User Avatar

    There are no random tests. Please add them.

  • Custom User Avatar

    kyu7 is IMO right level.

  • Custom User Avatar

    I found the kata very cumbersome. I read an article on Wikipedia to test against Primality and tried the rules like searching numbers lower than sqrt(n), only odds, etc. but it still failed on skip = 1,000,000 and limit = 10. I don't know why it took so long and have no idea how to skip things in Streams! Then, I found, again on Wikipedia, Sieve of Atkins. It's faster. I don't know if this is a proper training. I colved the kata but there are parts of the algorithms I still don't understand.

  • Custom User Avatar
  • Loading more items...