Solución

@loredovictor75_657e5d57·12/7/2026TypeScript
solution.tsTypeScript
export function searchMatrix(matrix: number[][], target: number): boolean {
  // Escribe tu solución aquí
  if (matrix.length === 0) return false;
  let row = 0;
  let col = matrix.length - 1;
  while (row < matrix.length && col >= 0) {
    if (matrix[row][col] === target) return true;
    if (matrix[row][col] > target) {
      col--;
    }
    if (matrix[row][col] < target) {
      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.