Ad
  • Custom User Avatar

    If only there would be a need for less-than-bruteforce factorization.

  • Custom User Avatar

    A hint: there are at least two functions available from importable modules that you can use directly.

  • Custom User Avatar
  • Custom User Avatar

    if exponent is 0 should return 1 instead of 0, provided modulus is more than 1. x^0===1 (mod y) y>1.

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

    While studying the problem I've stumbled on an online tool to generate such regexes. It was an ordeal trying to make the regex by hand using principles explained in there, but at least I did my own in here :)

  • Custom User Avatar

    I see familiar digits in here. I wonder if this outcome is equalling mine.

  • Custom User Avatar

    A new thing: I passed all tests but the "precheck" and the kata does not let me through. Yes I used inefficient algorithms most likely, yet I did a worthy shortcut across wild-guessing over a largely uncovered field without clues. What's there in the precheck that makes me stuck for 1 second or above? I don't want to shortcut the precheck too. (Also maybe my precalculations for a decent try run for too long per test, yet they help)

  • Custom User Avatar

    So, am I right that the challenge implies that zeroes provided at the start are ALL of those that exist on the map? If yes, this is a flaw in the kata's description, not the tests, and a piece of information I really did not use yet.

  • Custom User Avatar

    Intermediate map:
    0 0 0 1 x
    0 1 1 2 1
    1 2 x 1 0
    ? ? 2 1 0
    ? ? 2 1 1
    ? ? 2 ? ?
    ? ? ? 2 1
    ? ? ? 1 0
    Mines left: 4

    The task:
    Number of mines: 6
    Original map (not necessarily the expected one !):
    0 0 0 1 x
    0 1 1 2 1
    1 2 x 1 0
    1 x 2 1 0
    1 1 2 1 1
    1 1 2 x 1
    1 x 3 2 1
    1 2 x 1 0

    Game map:
    0 0 0 ? ?
    0 ? ? ? ?
    ? ? ? ? 0
    ? ? ? ? 0
    ? ? ? ? ?
    ? ? ? ? ?
    ? ? ? ? ?
    ? ? ? ? 0

    Your answer:
    ?

    Expected:
    0 0 0 1 x
    0 1 1 2 1
    1 2 x 1 0
    1 x 2 1 0
    1 1 2 1 1
    1 1 2 x 1
    1 x 3 2 1
    1 2 x 1 0

    I can't see where can I open in this situation. A mine can literally be everywhere in the vicinity of open cells. I can't open the 3 as there are solutions with x in place of that 3. So I return a ? and the test (this map is an unsolved part of some big test I encountered while attempting a solution that I stripped off there in case I can debug) says that I should have uncovered the entire map. Please verify if this should be machine-solvable, or hint me at what I am missing.

  • Custom User Avatar

    20000/20000 is easy, worst case is actually 10000/20000.

  • Custom User Avatar

    With 0 eggs and 1 floor you don't know if the egg would break while dropping from floor #1 or not, as you have 0 eggs to test. So it's proper to return zero here as if a house would have 0 floors, we can say that throwing eggs from that height won't break them even having no eggs.

  • Custom User Avatar

    Do not explicitly check vs int, do check with list/not list, all you need to check structure is whether an element can be iterated through or not. If yes, consider it a list, if not, an int should be equal to a None.

  • Custom User Avatar

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

  • Loading more items...