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.
does this answer your ( first ) question?
It's what you might know by the name "box" from 9x9 sudoku.
I removed the
booltest to remove ambiguityI also struggled with this one, because the preferred
isinstance(x, int)results in a failing test. Looking at the top accepted answers, they usetype(x) == int, which is NOT considered good python code, but the test is forcing you to write bad python code. Even the "ask for forgiveness not permission" method of wrappingint(x) == xin a try/except fails. I don't consider this test case to be enforcing good, idiomatic python code.I agree. I find two things somewhat irritating:
a) is the program supposed to really check for a proper sudoku (solution) or just for the explicitly validation criteria.
b) the explicitly given validation criteria requires internal squares,
but a given test matrix which is suposed to validate as True is 24x25 rather than 25x25, which means
the according internal squares don't all exist, i.e. it should validate to False
Tests and details contradict each other.
If you state that a NxN matrix with sqrt(N) = Integer is given, then your test cases should not include examples where these conditions are not fulfilled
Also details clearly state that a 1x1 matrix is valid yet test say otherwise.
This could have been a simple and nicekata but ends up being horrible due to poor instructions and inadequate test cases.
... or in easier terms: Consider N copies of the same valid block.
Despite the fact that some languages blur the lines or allow implicit casting/coercion, boolean values are not integers in the general sense.
It is perfectly reasonable to assume without further clarification that "integer" means "member of the integer subset of the
Numberprimitive", if we are in JavaScript. If we are in many other modern languages which have learned from the errors of earlier ones, trying to use a boolean as a numeric would (rightfully) throw an error. Type contracts are stronger and more meaningful when they are more strict.This is barely an ambiguity and certainly not something that rises to the level of an
issuewith the kata.The problem itself being setup for multiple languages makes no mention of JavaScript "Numbers" but instead only "integers".
In javascript, the
Number,BigIntorBooleanprimitives may be used to represent what we consider an integer.I don't see the justification of why the
Numberprimitive ought to be the only acceptable way to represent a mathematical integer.I think that the test case of "
[ [ true ] ]should return false", should be omitted from the tests as it's ambigious, and would require deeper context.Disagree this is an issue. Booleans are their own distinct primitive in JS, they are strictly not a "special case of
number". There is no reason the validation logic for this kata should be any more complicated than "is it anumber?"I think some others have noted this here, but for Javascript there is a test case of [ [true] ] which is dissallowed. Booleans are typically considered a special case of
number, and behave as such in JS (i.e.,5 + true == 6). It seems that[ [ true ] ]should be true as a best practice as the trivial sudoku of 1x1 can only have one value1which is best represented by a boolean.itertools.batchedadded in Python v3.12. Codewars uses Python v3.11.For some reason
itertools.batcheddoes not exist in itertools library for python. Is this intended?This was a fun one. Just some issues with some tests, but figured it out.
wtf is a little square?
Loading more items...