How to find all possible substring of a given string? | C# Interview Question | ASP.NET Core | MVC

preview_player
Показать описание
C# Problem solving interview questions for .NET Developers
How to find all possible substring of a given string?
public class Program
{
public static void Main()
{
string input = "abcdef";
var sb = new StringBuilder();

for (int i = 0; i lesserthan input.Length; i++)
{
for (int j = i; j lesserthan input.Length; j++)
{
sb.Append(input[j]);
Console.WriteLine(sb.ToString());
}
sb.Clear();
}
Console.ReadLine();
}
}
Рекомендации по теме
join shbcf.ru