当前位置:网站首页>205. 同构字符串
205. 同构字符串
2022-07-04 12:48:00 【anieoo】
原题链接:205. 同构字符串
solution:
保证一个字母对应一个映射
class Solution {
public:
bool isIsomorphic(string s, string t) {
unordered_map<char,char> st,ts;
int n = s.size();
//保证一个字母只有一个映射即可
for(int i = 0;i < n;i++) {
if(st.count(s[i])) {
if(st[s[i]] != t[i]) return false;
} else {
st[s[i]] = t[i];
}
if(ts.count(t[i])) {
if(ts[t[i]] != s[i]) return false;
} else {
ts[t[i]] = s[i];
}
}
return true;
}
};边栏推荐
- C語言宿舍管理查詢軟件
- ASP. Net core introduction I
- Install Trinity and solve error reporting
- 微服务入门
- 美国土安全部长:国内暴力极端主义是目前美面临的最大恐怖主义威胁之一
- Service Mesh的基本模式
- ViewBinding和DataBinding的理解和区别
- It is six orders of magnitude faster than the quantum chemical method. An adiabatic artificial neural network method based on adiabatic state can accelerate the simulation of dual nitrogen benzene der
- Redis —— How To Install Redis And Configuration(如何快速在 Ubuntu18.04 与 CentOS7.6 Linux 系统上安装 Redis)
- Oracle 被 Ventana Research 评为数字创新奖总冠军
猜你喜欢

Distributed base theory

面试拆解:系统上线后Cpu使用率飙升如何排查?

逆向调试入门-PE结构-资源表07/07

【R语言数据科学】:交叉验证再回首

2022kdd pre lecture | 11 first-class scholars take you to unlock excellent papers in advance

硬件基础知识-二极管基础

Byte interview algorithm question

上汽大通MAXUS正式发布全新品牌“MIFA”,旗舰产品MIFA 9正式亮相!

Database lock table? Don't panic, this article teaches you how to solve it

Interview disassembly: how to check the soaring usage of CPU after the system goes online?
随机推荐
C语言程序设计
Go 语言入门很简单:Go 实现凯撒密码
舔狗舔到最后一无所有(状态机)
AI painting minimalist tutorial
Flet tutorial 03 basic introduction to filledbutton (tutorial includes source code) (tutorial includes source code)
【Antd踩坑】Antd Form 配合Input.Group时出现Form.Item所占据的高度不对
Introduction to XML III
.NET 使用 redis
C language programming topic reference
2022g3 boiler water treatment examination question simulation examination question bank and simulation examination
Flet教程之 03 FilledButton基础入门(教程含源码)(教程含源码)
Cors: standard scheme of cross domain resource request
美国土安全部部长警告移民“不要踏上危险的旅程”
C#基础补充
CVPR 2022 | 大幅减少零样本学习所需的人工标注,提出富含视觉信息的类别语义嵌入(源代码下载)...
Five "potential errors" in embedded programming
SCM polling program framework based on linked list management
Building intelligent gray-scale data system from 0 to 1: Taking vivo game center as an example
8 expansion sub packages! Recbole launches 2.0!
近日小结(非技术文)