Reverse and Concatenate

You are given a string ss of length nn and a number kk. Let's denote by rev(s)rev(s) the reversed string ss (i.e. rev(s)=snsn−1...s1rev(s)=snsn−1...s1). You can apply one of the two kinds of operations to the string:
replace the string ss with s+rev(s)s+rev(s)replace the string ss with rev(s)+srev(s)+s
How many different strings can you get as a result of performing exactly kk operations (possibly of different kinds) on the original string ss?
In this statement we denoted

Reverse and Concatenate最先出现在Python成神之路

版权声明:
作者:admin
链接:https://www.techfm.club/p/16645.html
来源:TechFM
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>