an n x n matrix valid row column contain integer 1 n inclusiveGiven n x n integer matrix matrix return true matrix valid otherwise return false example 1input matrix 123312231output trueexplanation in case n 3 row column contain number 1 2 3hence return trueexample 2input matrix 111123123output falseexplanation in case n 3 row column contain number 2 3hence return false Constraintsn matrixlength matrixilength1 n 1001 matrixij n