#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.
'매일매일개발 > Codewars' 카테고리의 다른 글
codewars #52 Are they the "same"? (6kyu) (0) | 2018.05.30 |
---|---|
codewars #51 Simple string indices (6kyu) (0) | 2018.05.29 |
codewars #49 Playing with digits (6kyu) (0) | 2018.05.25 |
codewars #48 A Rule of Divisibility by 13 (6kyu) (0) | 2018.05.24 |
codewars #47 String repeat (8kyu) (0) | 2018.05.23 |