当前位置:网站首页>242. valid Letter heteronyms
242. valid Letter heteronyms
2022-07-01 03:43:00 【Sun_ Sky_ Sea】
242. Effective alphabetic words
Original title link :https://leetcode.cn/problems/valid-anagram/
Given two strings s and t , Write a function to determine t Whether it is s Letter heteronym of .
Be careful : if s and t Each character in the has the same number of occurrences , said s and t They are mutually alphabetic words .
Example 1:
Input : s = “anagram”, t = “nagaram”
Output : true
Example 2:
Input : s = “rat”, t = “car”
Output : false
Tips :
1 <= s.length, t.length <= 5 * 104
s and t Only lowercase letters
Their thinking :
Count the number of characters in the string , In the dictionary , Then judge whether the dictionaries are the same .
Code implementation :
class Solution:
def isAnagram(self, s: str, t: str) -> bool:
import collections
a = collections.defaultdict(int)
b = collections.defaultdict(int)
for c in s:
a[c] += 1
for c in t:
b[c] += 1
if a == b:
return True
return False
边栏推荐
- 【TA-霜狼_may-《百人計劃》】2.3 常用函數介紹
- Implement pow (x, n) function
- Cygwin的下载和安装配置
- [TA frost wolf \u may- hundred people plan] 1.3 secret of texture
- 完全背包问题
- 快速筛选打卡时间日期等数据:EXCEL筛选查找某一时间点是否在某一时间段内
- Research on target recognition and tracking based on 3D laser point cloud
- Database DDL (data definition language) knowledge points
- Error: plug ins declaring extensions or extension points must set the singleton directive to true
- Use of comment keyword in database
猜你喜欢

Research on target recognition and tracking based on 3D laser point cloud

二叉树神级遍历:Morris遍历

使用selenium自动化测试工具爬取高考相关院校专业招生分数线及排名情况

【TA-霜狼_may-《百人计划》】1.4 PC手机图形API介绍

RSN:Learning to Exploit Long-term Relational Dependencies in Knowledge Graphs
![[small sample segmentation] interpretation of the paper: prior guided feature enrichment network for fee shot segmentation](/img/b3/887d3fb64acbf3702814d32e2e6414.png)
[small sample segmentation] interpretation of the paper: prior guided feature enrichment network for fee shot segmentation

How keil displays Chinese annotations (simple with pictures)

IPv4和IPv6、局域网和广域网、网关、公网IP和私有IP、IP地址、子网掩码、网段、网络号、主机号、网络地址、主机地址以及ip段/数字-如192.168.0.1/24是什么意思?

实现pow(x,n)函数

Addition without addition, subtraction, multiplication and division
随机推荐
Online public network security case nanny level tutorial [reaching out for Party welfare]
208. 实现 Trie (前缀树)
Database DDL (data definition language) knowledge points
数据库中COMMENT关键字的使用
Review column - message queue
Error: plug ins declaring extensions or extension points must set the singleton directive to true
4、【WebGIS实战】软件操作篇——数据导入及处理
LeetCode 144二叉树的前序遍历、LeetCode 114二叉树展开为链表
4. [WebGIS practice] software operation chapter - data import and processing
pytorch nn.AdaptiveAvgPool2d(1)
409. 最长回文串
[TA frost wolf \u may- hundred people plan] 2.4 traditional empirical lighting model
Include() of array
Explain spark operation mode in detail (local+standalone+yarn)
IPv4 and IPv6, LAN and WAN, gateway, public IP and private IP, IP address, subnet mask, network segment, network number, host number, network address, host address, and IP segment / number - what does
【EI会议】2022年国际土木与海洋工程联合会议(JCCME 2022)
8. 字符串转换整数 (atoi)
深度学习中的随机种子torch.manual_seed(number)、torch.cuda.manual_seed(number)
Leetcode 31 next spread, leetcode 64 minimum path sum, leetcode 62 different paths, leetcode 78 subset, leetcode 33 search rotation sort array (modify dichotomy)
[reach out to Party welfare] developer reload system sequence