Solución
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