Solución

@aventuradev·29/5/2026TypeScript
solution.tsTypeScript
export function wordSearch(grid: string[][], word: string): boolean {
  // Escribe tu solución aquí
  const plain = grid.flat();
  let currentIndex = 0;
  let newWord = '';
  
  for(let i = 0; i < word.length; i++){
    const l = plain.slice(currentIndex).find(letter => letter === word[i]);
   
    if(!!l){
      newWord += word[i];
      currentIndex = plain.slice(currentIndex).indexOf(word[i])+1;
    }
  }

  return word === newWord;
}
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.