public class Solution
    {
        public bool RotateString(string A, string B)
        {
            string temp = A;
            int len = A.Length;
            int lenB = B.Length;
            if (len != lenB)
            {
                return false;
            }

            if (len == 0)
            {
                return true;
            }
            for (int i = 0; i < len; i++)
            {
                var prefix = A.Substring(0, i);
                var next = A.Substring(i);
                if (B.Equals(next + prefix))
                {
                    return true;
                }
            }
            return false;
        }
    }

 

posted on 2018-09-30 14:14  Sempron2800+  阅读(85)  评论(0编辑  收藏  举报