#50 String -> N iterations -> String



Welcome

This kata is inspired by This Kata


We have a string s


We have a number n


Here is a function that takes your string, concatenates the even-indexed chars to the front, odd-indexed chars to the back.


Examples

s = "Wow Example!"

result = "WwEapeo xml!"

s = "I'm JomoPipi"

result = "ImJm ii' ooPp"

The Task:

return the result of the string after applying the function to it n times.


example where s = "qwertyuio" and n = 2:


after 1 iteration  s = "qetuowryi"

after 2 iterations s = "qtorieuwy"

return "qtorieuwy"

Note

There are 50000 random tests where


the string contains between 50 and 200 chars

n is greater than a billion

so be ready to optimize.


+ Recent posts