Solución

@estouchedisindo·11/5/2026TypeScript
solution.tsTypeScript
export function kmpSearch(text: string, pattern: string): number[] {
  // Escribe tu solución aquí
  const regex = new RegExp(`(?=(${pattern}))`, 'g');
  const matches = text.matchAll(regex);
  const matchesArray = Array.from(matches);
  const matchIndexes = matchesArray.map(match => match.index);

  console.log(regex, matches, matchesArray, matchIndexes)

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