Ad
  • Default User Avatar

    When testing to see if a number is prime, you don't actually have to test every possible divisor up to that number. You can just test every possible divisor up to the square root of that number plus one.

    for num in range(2, number): --> for num in range(2, int(number ** 0.5 + 1)):

    Saves a lot of time. Hope this helps.

  • Default User Avatar

    Instructions say "Assume that x is an unsigned, 32-bit integer".
    But random tests (python, btw) are giving me 50+ bit integers for x, such as 7,138,606,154,252,560.

  • Default User Avatar

    This kata was kind of brutal.
    Hint for future solvers: Note that [threshold] is a percentage, not a constant.
    And don't forget you can add your own tests in the Sample Tests window.

  • Default User Avatar

    To phrase the problem a different way: You have 6 single-slice toasters. Given the number of slices of bread, return either the number of toasters still available or the number of slices of bread still waiting to be toasted. (ie: the over/under)

  • Default User Avatar

    Note: damage_per_attack means damage given per attack, not damage received per attack.
    (It's sort of obvious, but not clearly stated, and could be interpreted either way.)

  • Default User Avatar

    Warning: The solution essentially requires some variant of one particular algorithm.

  • Default User Avatar

    Hint: At what stage can you set aside one local maximum sum and start working on the next local maximum sum?