当前位置:网站首页>242. Effective letter heteronyms
242. Effective letter heteronyms
2022-07-26 10:51:00 【Forest_ one thousand and ten】

Using arrays a by s Every letter in the book +1 Count , Re traversal t, Subtract all the letters that appear 1, Finally, traverse the array a, If there is, it does not mean 0 The situation of , Description is not a heterotopic word .
class Solution {
public:
bool isAnagram(string s, string t) {
char a[26]={
0};
for(int i=0;i<s.size();++i)
{
a[s[i]-'a']++;
}
for(int i=0;i<t.size();++i)
{
a[t[i]-'a']--;
}
for(int i=0;i<26;++i)
{
if(a[i]!=0)
return false;
}
return true;
}
};
An array is like a simple hash table .
边栏推荐
- 20210807 1 c language program structure
- 解决:无法加载文件 C:\Users\user\AppData\Roaming\npm\npx.ps1,因为在此系统上禁止运行脚本 。
- Stringing of macro parameters and connection of macro parameters in C language
- SQL Server 之Sql语句创建数据库
- Disable usbjatg in Altium Designer
- 企鹅龙(DRBL)无盘启动+再生龙(clonezilla)网络备份与还原系统
- Wechat official account development obtains openid times error 40029 invalid code solution
- RT-Thread 学习笔记(一)---配置RT-Thread开发环境
- Wechat official account message notice "errCode": 40164, "errmsg": "invalid IP
- 软件测试综述之软件测试的背景、实质、软件开发的过程
猜你喜欢

Traversal recursion + iteration of binary tree

RT thread learning notes (V) -- edit, download and debug programs

使用Selenium抓取zabbix性能监控图

Bash shell学习笔记(一)

二叉树的遍历 递归+迭代
![[leetcode daily question 2021/2/18] [detailed explanation] minimum number of turns of 995. K continuous bits](/img/de/62fca587cde95110c2a967ca93eea5.png)
[leetcode daily question 2021/2/18] [detailed explanation] minimum number of turns of 995. K continuous bits

20210807 1 c language program structure

Bash shell学习笔记(四)

Add touch screen driver for stemwin 5.22 on Shenzhou IV development board

【小程序】onReachBottom 事件为什么不能触发 ?(一秒搞定)
随机推荐
C语言鹏哥20210812C语言函数
Bash shell学习笔记(四)
Wireshark basic tutorial Ethernet frame analysis.
Sql Server 数据库之初学体验
使用grid实现左中右布局,中间内容自适应
344.反转字符串
如何组装一个注册中心?
@The real difference and usage between validated and @valid
router.push(),router.repalce(),router.go()使用
flutter 背景变灰效果,如何透明度,灰色蒙板遮罩
Sql Server之查询总结
二叉树的遍历 递归+迭代
Halcon模板匹配之Shape
Pengge C language sixth class
232. Implement queue with stack
微信公众号开发 获取openid时报错40029 invalid code 问题的解决
242.有效的字母异位词
[leetcode daily question 2021/2/18] [detailed explanation] minimum number of turns of 995. K continuous bits
使用flex实现左中右布局,中间自适应
Sql Server 数据库之完整性约束