Solución

@juancalero942_0aea84f9
·hace 2dTypeScript
solution.tsTypeScript
export function intercalateChars(first: string, second: string): string {
  let result: string[] = []
  const minLength = Math.min(first.length, second.length)

  for (let i = 0; i < minLength; i++) {
    result.push(first[i], second[i])
  }

  if (first.length > minLength)
    result.push(first.slice(minLength))
  
  if (second.length > minLength)
    result.push(second.slice(minLength))

  return result.join("");
}
0respuestas
Respuestas
0

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.
Markdown