Ad
  • Custom User Avatar

    Looks like there is a problem with very hard test

    clues = [ 0, 2, 3, 0, 2, 0, 0, 
              5, 0, 4, 5, 0, 4, 0,
              0, 4, 2, 0, 0, 0, 6,
              0, 0, 0, 0, 0, 0, 0 ]
    
    expected = [[7, 6, 2, 1, 5, 4, 3],
                [1, 3, 5, 4, 2, 7, 6],
                [6, 5, 4, 7, 3, 2, 1],
                [5, 1, 7, 6, 4, 3, 2],
                [4, 2, 1, 3, 7, 6, 5],
                [3, 7, 6, 2, 1, 5, 4],
                [2, 4, 3, 5, 6, 1, 7]]
    

    My code returns other valid (I believe) solution:

    [[7, 6, 1, 2, 5, 4, 3],
     [1, 4, 6, 3, 2, 7, 6],
     [6, 1, 5, 7, 4, 3, 2],
     [5, 7, 4, 6, 3, 2, 1],
     [4, 3, 2, 1, 7, 6, 5],
     [3, 2, 7, 6, 1, 5, 4],
     [2, 5, 3, 4, 6, 1, 7]]
    
  • Custom User Avatar

    I think there is problem with one test. Namely:

    var clues = [ 0, 3, 0, 3, 2, 3,
                  3, 2, 0, 3, 1, 0,
                  0, 3, 0, 5, 3, 4,
                  0, 0, 0, 0, 0, 1];
    
    var expected = [[6,2,3,4,5,1],
                    [5,1,6,2,3,4],
                    [4,3,5,1,6,2],
                    [2,6,4,5,1,3],
                    [1,5,2,3,4,6],
                    [3,4,1,6,2,5]];
    

    My code returns other valid solution:

    [[6,1,5,2,3,4],
     [3,4,6,1,2,5],
     [5,3,4,5,6,1],
     [1,6,3,4,5,2],
     [4,5,2,3,1,6],
     [2,2,1,6,4,3]];
    

    @FrankK, can you please look into this.

  • Default User Avatar

    I fixed this problem by rounding result values.