Solución

@duron03·hace 1dTypeScript
solution.tsTypeScript
function wordInMatrix(matrix: string[][], word: string): boolean {
  let rowComparator: string = "";
  for (let i: number = 0; i < matrix.length; i++) {
    rowComparator += matrix[i][0];
    let columnComparator: string = "";
    for (let j: number = 0; j < matrix[0].length; j++) {
      columnComparator += matrix[i][j];
    }
    if (rowComparator === word || columnComparator === word) return true;
  }
  return false;
}

// No modificar: necesario para evaluar el resultado.
export { wordInMatrix };
0respuestas
Respuestas

Aún no hay respuestas

¡Sé el primero en responder!

Escribir un comentario

Recuerda ser amable. Estás comentando la solución de otra persona. Comparte tu perspectiva de forma constructiva y respetuosa.

Debes iniciar sesión para publicar un comentario.