Ad
  • Custom User Avatar

    I've faced with the same problem.
    UPD: there is no problem, kata is ok - check postgre documentation

  • Custom User Avatar
  • Custom User Avatar

    Great.
    Short & clear description it is a good motivation to solve the kata :)

  • Custom User Avatar

    It's enough to check numbers to the square root of N.

    const sqr = Math.ceil(Math.floor(n));
    for (let i = 2; i <= sqr; i++) if (n % i) return false;
    return n >= 2;
    
    

    It is useful out of concern for performance

    P.S. I hate CW's comment editor

  • Custom User Avatar
    Given this input: [ [ 0, 0, 0, 0 ], [ 0, 0, 0, 3 ], [ 3, 2, 4, 1 ], [ 4, 0, 0, 2 ] ]
    I get:
    Expected: [[1, 3, 2, 4], [2, 4, 1, 3], [3, 2, 4, 1], [4, 1, 3, 2]], instead got: 'This sudoku is unsolvable!'
    The expected result is correct. What are you confused about?
  • Custom User Avatar

    Probably, he wanted to simplify the kata.

    Just disregard what you've seen in the kata
    Yeah, it seems that for those who'll see the updated description for the first time everything is gonna be okay :)
  • Custom User Avatar

    Ok, as I can see from the "Fixed tests" - 2x2 regions should be unique.
    But problems with the random tests are still present.

  • Custom User Avatar

    It is obviously.

    The goal of standard sudoku: fill in the numbers 1-9 exactly once in every row, column, and 3x3 region.
    
    

    I mean, should digits in 2x2 regions from this kata be unique too?
    In the author's initial description it was said to ignore it. For now - it is unclear.

  • Custom User Avatar
    1. It is unclear whether the subsquares should be validated or they are not considered as it was initially.
      Please add it to the description.
    2. There are still some issues with the random tests:
    Given: [ [ 0, 0, 2, 0 ], [ 0, 0, 0, 3 ], [ 0, 0, 0, 4 ], [ 0, 0, 3, 0 ] ]
    Expected: 'This sudoku is unsolvable!', instead got: [[3, 4, 2, 1], [1, 2, 4, 3], [2, 3, 1, 4], [4, 1, 3, 2]]
    
    Given: [ [ 2, 4, 3, 1 ], [ 0, 0, 0, 0 ], [ 3, 1, 0, 4 ], [ 4, 2, 0, 0 ] ]
    Expected: 'This sudoku is unsolvable!', instead got: [[2, 4, 3, 1], [1, 3, 4, 2], [3, 1, 2, 4], [4, 2, 1, 3]]
    
    

    Is there a problem with the etalon solution?

    P.S. Anyway, the kata is better now :)

  • 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

    There are still several wrong cases, e.g.

    Given: [ [ 3, 1, 0, 4 ], [ 0, 2, 0, 0 ], [ 0, 3, 0, 2 ], [ 0, 1, 1, 3 ] ]
    Expected: [[3, 1, 2, 4], [4, 2, 3, 1], [1, 3, 4, 2], [2, 1, 1, 3]], instead got: 'This sudoku is unsolvable!'
    
    Given: [ [ 0, 0, 0, 3 ], [ 0, 3, 2, 0 ], [ 3, 1, 4, 2 ], [ 2, 4, 0, 2 ] ]
    Expected: [[4, 2, 1, 3], [1, 3, 2, 4], [3, 1, 4, 2], [2, 4, 3, 2]], instead got: 'This sudoku is unsolvable!'
    
  • Custom User Avatar

    Ok with it, but I've created another issue for the random tests :)

  • Custom User Avatar

    Сheck the random tests, it just seems like they are broken:

    
    For the given: [ [ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ], [ 4, 0, 0, 0 ] ]
    Expected: 'This sudoku is unsolvable!', instead got: [[1, 2, 3, 4], [2, 1, 4, 3], [3, 4, 1, 2], [4, 3, 2, 1]]
    
    For the given: [ [ 4, 1, 3, 2 ], [ 1, 2, 1, 3 ], [ 3, 1, 2, 4 ], [ 2, 3, 4, 1 ] ]
    Expected: [[4, 1, 3, 2], [1, 2, 1, 3], [3, 1, 2, 4], [2, 3, 4, 1]], instead got: 'This sudoku is unsolvable!'
    
  • Custom User Avatar

    Description says the opposite:

    you must come up with a function which will correctly fill out ANY Mini Sudoku board. The test cases will only include puzzles with one possible solution or they will be impossible.
    if the sudoku is unsolvable the function should return "This sudoku is unsolvable!"

  • Loading more items...