Problem 269. Find Rotated Substring
Given a string s1, find if a rotated version of s1 is present in a second string s2.
For example, rotated version of some strings are:
"matlabcentral" => "atlabcentralm" => .. => "centralmatlab" etc.
So, if
s1 = 'matlabcentral';
s2 = 'thecentralmatlab';
then the result is true.
Solution Stats
Problem Comments
-
2 Comments
@bmtran (Bryant Tran)
on 6 Feb 2012
the last test case fails due to an incorrect call of the function. also, could you stick %% between each of the test cases so that they show up as separate?
zhiyuan
on 1 Aug 2021
The function circshift is useful!
Solution Comments
Show commentsProblem Recent Solvers222
Suggested Problems
-
Project Euler: Problem 2, Sum of even Fibonacci
2146 Solvers
-
Back to basics 9 - Indexed References
433 Solvers
-
Remove the two elements next to NaN value
642 Solvers
-
Reverse the elements of an array
986 Solvers
-
Create an n-by-n null matrix and fill with ones certain positions
541 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!