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

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

Code Debugged

1 год назад

205 Просмотров

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();
}
}

Тэги:

#c# #problem_solving #interview_questions #interview #substring_of_given_string #substring
Ссылки и html тэги не поддерживаются


Комментарии: