//https://leetcode.com/problems/repeated-substring-pattern/
public class Solution {
public bool RepeatedSubstringPattern(string s) {
int minSubstrLength = 1;
int maxSubstrLength = s.Length / 2;
StringBuilder sb = new StringBuilder();
for (int i = minSubstrLength; i <= maxSubstrLength; i++)
{
int substrLength = i;
string substr = s.Substring(0, substrLength);
int nTimesRepeat = s.Length / substrLength;
sb.Clear();
for (int j = 0; j < nTimesRepeat; j++)
sb.Append(substr);
if (s.Equals(sb.ToString()))
return true;
}
return false;
}
}
-
MY PROJECTS
-
Recent Posts
- Database.Middle.What are surroget keys ?
- Database.Middle.Explain the difference between OLTP and OLAP.
- Database.Middle.Partitions and sharding, differenes
- Database.Middle.do i see different tables in some sql explorer like dataGrip, for example ?
- Database.Middle.How does database partitioning work?
- Database.Middle.What is a trigger? How and when would you use it?
- Database.Middle.What is the difference between ROW_NUMBER(), RANK(), and DENSE_RANK()?
- Database.Middle.What are CTEs (Common Table Expressions)?
- Database.Middle.If i don’t use ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW, so i take all rows ?
- Database.Middle.WindowFunctions.Explain ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
- Database.Total.Give examples with Sum(), Avg(), Max()
- Database.Middle.What is window function?
- Database.Middle.Pagination.SeekMethod.What if some rows were deleted ?
- Database.Middle.Why, when we seek for pages no shifting from inserts/deletes on other rows ?
- Database.Middle.What is the Seek Method?
- Database.Middle.How would you implement pagination in SQL?
- Database.Middle.What is eventual consistency?
- Database.Middle.Explain the concept of sharding in databases.
- Database.Middle.MaterializedView
- Database.Middle.How can you detect and resolve deadlocks?
Categories
- Aptana
- Azure
- C#
- DataSnap
- DBExpress
- Delphi
- Delphi и сети
- Delphi. Язык программирования
- ExtJS
- FastReport
- FireDAC
- FireMonkey
- GIT
- ICS
- IDE
- IIS
- Indy
- InnoSetup
- javascript
- jQuery
- JSON
- LiveBindings
- MSHTML
- MySQL
- PHP
- REST
- Ribbons
- SMS
- SQL инструкции
- SVN
- TRichView
- UniGui
- WebBroker
- WinAPI
- Windows
- Алгоритмы
- Без рубрики
- Деревья
- Ищу ответ
- Компонентостроение
- Мои компоненты
- Начальный уровень
- Обработка исключений
- Парсинг
- Потоки(Threads)
- Регулярные выражения
- Тестирование приложений