当前位置:网站首页>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 .
边栏推荐
- Analysis of C # delegation and anonymous method
- Anaconda is used on vscode (the environment has been configured)
- 为什么需要自动化测试?软件测试师带你测评不同软件测试工具
- 如何组装一个注册中心?
- [leetcode daily question 2021/4/29]403. Frogs cross the river
- MultipartFil转为File
- list升序和降序
- 智能合约dapp系统开发流程技术
- Pengge C language - minesweeping 2021-08-16
- 104.二叉树的最大深度
猜你喜欢

在神州IV开发板上成功移植STemWin V5.22

Many people don't know whether they are looking for Kanban software or Kanban software

RT thread learning notes (III) -- building a compilation environment with scons

Traversal recursion + iteration of binary tree

SCADA和三大工业控制系统PLC、DCS、FCS

2021-08-12函数递归_和鹏哥学习C语言

242.有效的字母异位词

20210807 1 c language program structure
![[leetcode daily question 2021/4/23]368. Maximum divisible subset](/img/0b/32ca862963c842a93f79eaac94fb98.png)
[leetcode daily question 2021/4/23]368. Maximum divisible subset

使用Selenium抓取zabbix性能监控图
随机推荐
[leetcode daily question 2021/4/29]403. Frogs cross the river
Sword finger offer (49): convert a string to an integer
[leetcode daily question 2021/8/31] 1109. Flight reservation statistics [medium] differential array
回到顶部的几种方案(js)
During the interview, how did the interviewer evaluate the level of rust engineers?
PLC与伺服电机连接
@The difference and use of jsonformat and @datetimeformat
使用grid实现左中右布局,中间内容自适应
Pengge C language 20210811 program structure operation
Summary of the seventh class of pengge C language
nmap弱点扫描结果可视化转换
RT-Thread 学习笔记(一)---配置RT-Thread开发环境
C language pengge 20210812c language function
二叉树的遍历 递归+迭代
LIst和Dictionary实例应用(※)
Anaconda is used on vscode (the environment has been configured)
list升序和降序
在神州IV开发板上为STemWin 5.22加入触屏驱动
RT thread learning notes (V) -- edit, download and debug programs
构建ARM嵌入式开发环境