Rotation of Each Other — Solution & Editorial
B is a rotation of A exactly when the lengths match and B occurs inside A + A.
Complexity: O(|A|) with linear string search (naive search also fits these limits)
B is a rotation of A exactly when the lengths match and B occurs inside A + A.
Complexity: O(|A|) with linear string search (naive search also fits these limits)