You need to sign in or sign up before continuing.×
3 kyu

T.T.T.35: Complete a matrix(3x3)

Description
Loading description...
Matrix
Algorithms
  • Please sign in or sign up to leave a comment.
  • ignacio-cuadra Avatar

    this kata works? in validations says that: input = [ [ 10 ,null, 8 ], [ null,11, 6 ], [null, 7 ,null] ] expected result = null but my result is = [ [ 10, 1, 8 ], [ 2, 11, 6 ], [ 7, 7, 5 ] ]

    in my result all lines sum 19

    • akar-0 Avatar

      I didn't solve this kata, but reading the discussion I understand that you should return also null if there is more than one solution (what I think the author meant with the condition is not enough). It's probably what's happening here.

    • ignacio-cuadra Avatar

      Yep, you're right. Thank you

      Issue marked resolved by ignacio-cuadra 3 years ago
  • dolamroth Avatar

    Liked this a lot, thank you :)

  • NewDeveloper Avatar

    Nice very hard kata, as 2kyu.

  • Hana1989 Avatar

    Nice kata :) I think that some details are missing in the description -

    1. Are duplicates allowed? (yes)
    2. What about diagnols? (ignore)
  • Firefly2002 Avatar

    Edit: Nvm, saw docgunthrop's question.

  • docgunthrop Avatar

    Question on some test cases:

    Test for: matrix = [[10,null,null],[5,null,20],[null,8,7]]
    
    ✘ Expected: 'null', instead got: '[[10, 17, 17], [5, 19, 20], [29, 8, 7]]' 
    

    Wouldn't this be a valid matrix with each row and column sum equaling 44?

    And for the 2nd basic test:

    ✘ Expected: 'null', instead got: '[[10, 7, 8], [8, 11, 6], [7, 7, 11]]'
    

    This should be a valid matrix with each row and column sum equaling 25.

    • myjinxin2015 Avatar

      These two examples return null only because their results are uncertain. For example, they can be like this:

      [[10,17,48],
       [5, 50,20],   --->equals to 75
       [60, 8, 7]]
      
      [ 10,10, 8 ],
      [ 11,11, 6 ],  --->equals to 28
      [  7, 7,14 ]]
      

      or other equaling value:

      [[10,17,73],
       [ 5,75,20],  --> equals to 100
       [85, 8, 7]]
      
      [ 10,82, 8 ],
      [ 83,11, 6 ],  --> equals to 100
      [  7, 7,86 ]]
      
    • docgunthrop Avatar

      Ah, thanks for the clarification. So if more than one solution is possible, then that satisfies the condition of uncertainty. Nice challenging kata!

      Question marked resolved by docgunthrop 8 years ago
  • mikalai-sauchanka Avatar

    According to the description 0 is a valid value. Looks like it's not, e.g. [[17,null,null],[11,16,1],[null,5,null]] expects null, my the outcome is [[17,7,4],[11,16,1],[0,5,23]]