Interview Query

String Shift

10
Have you seen this question before?

Given two strings AA and BB, write a function can_shift to return whether or not AA can be shifted some number of places to get BB.

Example:

Input:

A = 'abcde'
B = 'cdeab'
can_shift(A, B) == True

A = 'abc'
B = 'acb'
can_shift(A, B) == False
Next question: Target Indices
.....
Python 3.9.6
Loading editor
Use Shift + Enter to run code