Solución

@crisemavargas20_60580a61·20/10/2026TypeScript
solution.tsTypeScript
export function searchMatrix(matrix: number[][], target: number): boolean {
  // Escribe tu solución aquí
  if(matrix.length === 0 || matrix[0].length === 0 )  return false;

  let row = 0;
  let col = matrix[0].length - 1;

  while(row < matrix.length && col >= 0){
    let value = matrix[row][col];
    if(value === target) return true;
    if(value > target) col --;
    else row ++;
  }

  return false;  
}
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.