Ad
  • Custom User Avatar

    Thank you sir for this kata.

  • Custom User Avatar

    it seemed to work fine on my machine

    this is not surprising and that's exactly the problem with undefined behavior in C/C++ ... many things can happen depending on the platform, the way the code is run, the compiler, etc. the worst case scenario is when nothing special happens, until that one day when a cryptic bug pops up from nowhere. there are some tools that can help, such as static analyzers. when i ran your code in this one, it correctly detected UB when run with an empty string (warning, this analyzer is free and online but it's a bit slow and the UB diagnostics can be a bit cryptic if you're not well versed on low-level details)

  • Custom User Avatar

    In Python everything seems to be +1-3 kyu easier, while half as fast.

  • Custom User Avatar

    thanks alot, small change big difference :)

  • Custom User Avatar

    It is because by use of float and real division operator /, you introduce small inaccuracies into your solution, which sometimes, in certain circumstances, for some inputs, can trick your solution into doing some incorrect approximation, or unintended rounding, because this is how floats work. When you change line 6 of your solution to something like time_decimal_secs = g * 60 * 60 // relative_speed, you have no floats anymore, no inaccuracies, and (if I see correctly) solution with this change will always pass.

    You can check what exactly happens by recreating one of failing inputs in your IDE and running it with a step-through debugger, observing intermediate variables. You will notice how in some point, some rounding happens, which slightly changes the outcome and leads to an incorrect answer.

  • Custom User Avatar

    It's not about tests which are "rounded up". It's about your code which is a bit buggy, and sometimes performs incorrect rounding.

  • Custom User Avatar

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

  • Custom User Avatar

    Print the input.

  • Custom User Avatar

    You forgot to return the sum.

  • Custom User Avatar
    "number1 number2 (and so on if necessary) sumOfCubicNumbers Lucky"
    

    3507 is the sum of the cubic numbers, not a kata issue.

  • Custom User Avatar
    "number1 number2 (and so on if necessary) sumOfCubicNumbers Lucky"
    
    number1 is 0 (the only cubic number there)
    sumOfCubicNumbers is 0
    Lucky needs no explanation
    

    Not a kata issue.

  • Custom User Avatar

    Random tests for Python add four digits not present in string at the end of every solution:

    Oh dear! is_sum_of_cubes("eiusmod labore :,! ,;. ::#. ipsum Ut ad :!!. ' dolor . . commodo 407371153 407 :.# adipiscing 0 ~;?? 153 0 153 ~ in ~, 3713710 1 velit 4071534071530") returned: '407 371 153 407 0 153 0 153 371 371 0 1 407 153 407 153 0 Lucky' should equal '407 371 153 407 0 153 0 153 371 371 0 1 407 153 407 153 0 3507 Lucky'

  • Custom User Avatar

    please don't open issues to ask for help, ask a question instead, unless you can prove that the problem comes from the test suite and not your code. there is some info about this error message in the Codewars docs

    All numbers in the list are positive numbers and the list can be empty.

    try your code with an empty string

  • Custom User Avatar

    testing("0 9026315 -827&()", "0 0 Lucky")
    how do you get 2 zeros here?
    if you count numbers inside numbers, then the output should be
    0 0 1

    1. the task description clearly shows that repetitions should be excluded

    worst problem description

  • Custom User Avatar

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

  • Loading more items...