Initial commit

This commit is contained in:
Electrominch
2022-10-04 13:40:57 +03:00
commit c9916dabad
34 changed files with 1289 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>_392._Is_Subsequence</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,10 @@
namespace _392._Is_Subsequence
{
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
}
}
}

View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _392._Is_Subsequence;
public class Solution
{
public bool IsSubsequence(string s, string t)
{
if (s.Length == 0)
return true;
int sIndex = 0;
for(int i = 0; i < t.Length; i++)
{
if (t[i] == s[sIndex])
{
sIndex++;
if (sIndex >= s.Length)
return true;
}
}
return false;
}
}