Harry and Porter asked in MountainBlue ,2022
Problem Statement
Harry and Potter choose a word string. Harry chose a number M (less than the length of the string) and Potter chose N (less than the length of the string).
Harry will cut M letters from the end of the string, add them to the beginning and will give it to Potter. Then, Potter will also cut N letters from the end of the string,
add it to the beginning and give it to Harry. This process
will continue till they get the original word string back.
For a given string and given values of M and N, find the number of turns in which they will get the original word string back
. Example If the string is AbcDef, M= 1 and N = 2 the Output must be 4 4604
Explanation This is how the words tend will change. Abcbef > fAbcDe Dejbes- cDefAb AbcDef As there are 4 steps needed to bring the.....................
Comments
Post a Comment