当前位置:网站首页>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 .
边栏推荐
- shell 脚本 失败自动重复执行
- Common classes (understand)
- Software Testing Overview: the background, essence and process of software testing
- Halcon模板匹配之Shape
- [leetcode daily question 2021/5/8]1723. The shortest time to complete all work
- 软件测试综述之软件测试的背景、实质、软件开发的过程
- 242.有效的字母异位词
- Flutter CachedNetworkImage圆角
- RT thread learning notes (V) -- edit, download and debug programs
- Sword finger offer (V): queue with two stacks
猜你喜欢

RT thread learning notes (V) -- edit, download and debug programs
![[machine learning notes] [face recognition] deeplearning ai course4 4th week programming](/img/7e/9c0e88097b90c0c24ebf86f090805b.png)
[machine learning notes] [face recognition] deeplearning ai course4 4th week programming
![[paper after dinner] deep mining external perfect data for chestx ray disease screening](/img/d6/41c75d292c26b2e7e116767a51eb5e.png)
[paper after dinner] deep mining external perfect data for chestx ray disease screening

RT-Thread 学习笔记(一)---配置RT-Thread开发环境

Disable usbjatg in Altium Designer

软件测试综述之软件测试的背景、实质、软件开发的过程

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

RT thread learning notes (I) -- configure RT thread development environment

The problem of formatting IAR sprintf floating point to 0.0 in UCOS assembly

mysql20210906
随机推荐
[leetcode daily question 2021/8/30]528. Choose randomly by weight [medium]
按二进制数中1的个数分类
[leetcode daily question 2021/2/13]448. Find all the missing numbers in the array
0x00007FFD977C04A8 (Qt5Sqld.dll)处(位于 a.exe 中)引发的异常: 0xC0000005: 读取位置 0x0000000000000010 时发生访问冲突
RT thread learning notes (VII) -- open the elmfat file system based on SPI flash (middle)
c 语言中宏参数的字符串化跟宏参数的连接
C语言命名空间的定义与使用
回到顶部的几种方案(js)
router.push(),router.repalce(),router.go()使用
RT thread learning notes (V) -- edit, download and debug programs
使用flex实现左中右布局,中间自适应
@The difference and use of jsonformat and @datetimeformat
微信公众号开发 获取openid时报错40029 invalid code 问题的解决
344.反转字符串
2021-08-14三子棋
MFC中0x003b66c3 处有未经处理的异常: 0xC000041D: 用户回调期间遇到未经处理的异常
RT thread learning notes (I) -- configure RT thread development environment
Sword finger offer (44): flip the word order sequence
【小程序】onReachBottom 事件为什么不能触发 ?(一秒搞定)
349. 两个数组的交集