796. Rotate String

 1 class Solution 
 2 {
 3 public:
 4     bool rotateString(string A, string B) 
 5     {
 6         if(A.length()==B.length()&&(A+A).find(B)!=string::npos)
 7             return true;
 8         return false;
 9     }
10 };

把俩A拼起来,能找到B,则可以通过循环右移将A转化为B

猜你喜欢

转载自www.cnblogs.com/zhuangbijingdeboke/p/9179269.html
今日推荐