当前位置:网站首页>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
边栏推荐
- 6. Z 字形变换
- torch.histc
- Include() of array
- [TA frost wolf \u may - "hundred people plan"] 2.1 color space
- [party benefits] jsonobject to string, leave blank
- [small sample segmentation] interpretation of the paper: prior guided feature enrichment network for fee shot segmentation
- Its appearance makes competitors tremble. Interpretation of Sony vision-s 02 products
- Online public network security case nanny level tutorial [reaching out for Party welfare]
- Bilinear upsampling and f.upsample in pytorch_ bilinear
- Home online shopping project
猜你喜欢

快速筛选打卡时间日期等数据:EXCEL筛选查找某一时间点是否在某一时间段内

pytorch训练深度学习网络设置cuda指定的GPU可见

Edge drawing: a combined real-time edge and segment detector

Access denied for user ‘ODBC‘@‘localhost‘ (using password: NO)

Avalanche problem and the use of sentinel

Ultimate dolls 2.0 | encapsulation of cloud native delivery
![[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

BluePrism注册下载并安装-RPA第一章

pytorch nn. AdaptiveAvgPool2d(1)

Its appearance makes competitors tremble. Interpretation of Sony vision-s 02 products
随机推荐
Edge drawing: a combined real-time edge and segment detector
Golang multi graph generation gif
Md5sum operation
Explain spark operation mode in detail (local+standalone+yarn)
Leetcode:829. Sum of continuous integers
AfxMessageBox和MessageBox的用法
FCN full Convolution Network Understanding and Code Implementation (from pytorch Official Implementation)
Pytorch training deep learning network settings CUDA specified GPU visible
Avalanche problem and the use of sentinel
Cookie&Session
Filter
在线公网安备案保姆级教程【伸手党福利】
Feature pyramid networks for object detection
Appium automation test foundation -- supplement: c/s architecture and b/s architecture description
Implement pow (x, n) function
pytorch nn.AdaptiveAvgPool2d(1)
Processing of menu buttons on the left and contents on the right of the background system page, and double scrolling appears on the background system page
Take you through a circuit board, from design to production (dry goods)
【伸手党福利】JSONObject转String保留空字段
214. 最短回文串