新增 哈希表部分的 C#版

This commit is contained in:
UndeadSheep
2022-05-11 19:44:09 +08:00
parent cf4c25b891
commit 8a562b7a25
6 changed files with 122 additions and 0 deletions

View File

@@ -307,6 +307,25 @@ impl Solution {
}
}
```
C#
```csharp
public bool IsAnagram(string s, string t) {
int sl=s.Length,tl=t.Length;
if(sl!=tl) return false;
int[] a = new int[26];
for(int i = 0; i < sl; i++){
a[s[i] - 'a']++;
a[t[i] - 'a']--;
}
foreach (int i in a)
{
if (i != 0)
return false;
}
return true;
}
```
## 相关题目
* 383.赎金信