Day10
This commit is contained in:
@@ -6,19 +6,19 @@ public class Solution
|
||||
{
|
||||
int[] letters = new int[26];
|
||||
foreach (char c in s1)
|
||||
letters[c-97]++;
|
||||
letters[c - 97]++;
|
||||
int[] buff = new int[26];
|
||||
Array.Copy(letters, buff, letters.Length);
|
||||
for (int i = 0; i <= s2.Length-s1.Length; i++)
|
||||
for (int i = 0; i <= s2.Length - s1.Length; i++)
|
||||
{
|
||||
if (letters[s2[i]-97] != 0)
|
||||
if (letters[s2[i] - 97] != 0)
|
||||
{
|
||||
Array.Copy(letters, buff, letters.Length);
|
||||
for(int j = i; j < i + s1.Length; j++)
|
||||
for (int j = i; j < i + s1.Length; j++)
|
||||
{
|
||||
char ch = s2[j];
|
||||
buff[ch - 97]--;
|
||||
if (buff[ch-97] < 0)
|
||||
if (buff[ch - 97] < 0)
|
||||
break;
|
||||
}
|
||||
bool win = true;
|
||||
|
||||
Reference in New Issue
Block a user