Пример #1
0
        public bool IsStringRotation2(string a, string b)
        {
            if (a.Length != b.Length)
            {
                return(false);
            }

            string compositeString = a + a;

            return(UtilStrings.IsSubstring(compositeString, b));
        }
Пример #2
0
        public bool IsStringRotation(string a, string b)
        {
            if (a.Length != b.Length)
            {
                return(false);
            }

            var sortedA = UtilSorting.MergeSort <char>(a.ToList());
            var sortedB = UtilSorting.MergeSort <char>(b.ToList());

            return(UtilStrings.IsSubstring(sortedA.ToString(), sortedB.ToString()));
        }