Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
If only there would be a need for less-than-bruteforce factorization.
A hint: there are at least two functions available from importable modules that you can use directly.
Not so easy. Imagine this: https://www.codewars.com/kata/reviews/55661000acc711e892000009/groups/5fab78001696050001928386
Really, this digs up a builtin.
if exponent is 0 should return 1 instead of 0, provided modulus is more than 1. x^0===1 (mod y) y>1.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
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 :)
I see familiar digits in here. I wonder if this outcome is equalling mine.
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)
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.
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.
20000/20000 is easy, worst case is actually 10000/20000.
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.
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.
This comment is hidden because it contains spoiler information about the solution
Loading more items...