Given a string s1 and a string s2, write a function to return whether s2 is a rotation of s1 using only one call to strstr (or a similar function)? For example:
is_rotation(ABCD, CDAB) //return true is_rotation(ABCD, ACBD) //return false
Given a string s1 and a string s2, write a function to return whether s2 is a rotation of s1 using only one call to strstr (or a similar function)? For example:
is_rotation(ABCD, CDAB) //return true is_rotation(ABCD, ACBD) //return false
Permalink: http://problemotd.com/problem/string-rotation/
Content curated by @MaxBurstein
Comments:
Anonymous - 9 years, 10 months ago
I think I got it. Python 3
reply permalink
Byron Mayne - 9 years, 9 months ago
reply permalink