Solución

@fernando_her85·6/5/2026TypeScript
solution.tsTypeScript
function rotateString(text: string, k: number): string {
  
  if (text.length === 0 || k === 0) return text;

  const kEff = k % text.length;
  if (kEff === 0) return text;

  const left = text.slice(0, kEff);
  const right = text.slice(kEff);

  return right + left; 
}

// No modificar: necesario para evaluar el resultado.
export { rotateString };
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.