//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
- Java.DBMigrationTools.What’s the impact of changing database credentials or URL during migration?
- Java.DBMigrationTools.What are common security concerns with migration tools?
- Java.DBMigrationTools.How can you ensure a schema migration is idempotent?
- Java.DBMigrationTools.How do you test migrations during pull request validation?
- Java.DBMigrationTools.How do you support rollbacks in Flyway (if at all)?
- Java.DBMigrationTools.How do you version control large changelog histories?
- Java.DBMigrationTools.How do you use migration tools in GitOps-based workflows?
- Java.DBMigrationTools.How do you detect and prevent duplicate changesets?
- Java.DBMigrationTools.How do you debug a failed migration in a pipeline?
- Java.DBMigrationTools.What causes a checksum mismatch and how do you fix it?
- Java.DBMigrationTools.How would you structure your changelog/migration folder hierarchy?
- Java.DBMigrationTools.How do you create migrations for read replicas or sharded systems?
- Java.DBMigrationTools.How can you log or monitor applied migrations in production?
- Java.DBMigrationTools.What strategies help avoid merge conflicts in changelog files?
- Java.DBMigrationTools.How do you simulate a migration on a dev database before applying to prod?
- Algo.Theory.Trees.TraverseOrders
- Java.DBMigrationTools.What’s the best approach to seed data with a migration tool?
- Java.DBMigrationTools.How do you deal with legacy databases in a migration tool?
- Java.DBMigrationTools.How do you write migrations that work in both MySQL and Postgres?
- Java.DBMigrationTools.CREATE INDEX without CONCURRENTLY (Postgres) and No non-transactional DDL when migrate
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)
- Регулярные выражения
- Тестирование приложений