Solución
solution.tsTypeScript
function wordInMatrix(matrix: string[][], word: string): boolean {
let newWordY:string = ''
let newWordX: string = ''
for(let i = 0; i < matrix.length; i++) {
newWordY = ''
for(let k = 0; k < matrix.length; k++){
newWordY += matrix[k][i]
if(newWordY === word){
return true;
}
}
}
for(let o =0; o < matrix.length; o++) {
newWordX = ''
for(let j = 0; j < matrix[o].length; j++) {
newWordX += matrix[o][j]
if(newWordX === word) {
return true;
}
}
}
return false;
}
// No modificar: necesario para evaluar el resultado.
export { wordInMatrix };0respuestas