Ad
  • Custom User Avatar

    does this answer your ( first ) question?

  • Custom User Avatar

    It's what you might know by the name "box" from 9x9 sudoku.

  • Custom User Avatar

    I removed the bool test to remove ambiguity

  • Custom User Avatar

    I also struggled with this one, because the preferred isinstance(x, int) results in a failing test. Looking at the top accepted answers, they use type(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 wrapping int(x) == x in a try/except fails. I don't consider this test case to be enforcing good, idiomatic python code.

  • Custom User Avatar

    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

  • Custom User Avatar

    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.

  • Custom User Avatar

    ... or in easier terms: Consider N copies of the same valid block.

  • Custom User Avatar

    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 Number primitive", 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 issue with the kata.

  • Custom User Avatar

    The problem itself being setup for multiple languages makes no mention of JavaScript "Numbers" but instead only "integers".

    In javascript, the Number, BigInt or Boolean primitives may be used to represent what we consider an integer.
    I don't see the justification of why the Number primitive 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.

  • Custom User Avatar

    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 a number?"

  • Custom User Avatar

    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 value 1 which is best represented by a boolean.

  • Custom User Avatar

    itertools.batched added in Python v3.12. Codewars uses Python v3.11.

  • Custom User Avatar

    For some reason itertools.batched does not exist in itertools library for python. Is this intended?

  • Custom User Avatar

    This was a fun one. Just some issues with some tests, but figured it out.

  • Custom User Avatar
  • Loading more items...