bool isIsomorphic(string s, string t) {
int size=s.size();
if (size==0)
return true;
char ch[128],ismap[128];
for(int i=0;i<128;i++)
{`enter code here`
ch[i]=-1;
ismap[i]=-1;
}
bool flag=true;
for(int i=0;i<size;i++)
{
if(ch[s[i]]==-1&&ismap[t[i]]==-1)
{
ch[s[i]]=t[i];
ismap[t[i]]=s[i]; }else if(ch[s[i]]!=t[i]||ismap[t[i]]!=s[i])
{
flag=false;
break;
}
}
return flag;
}

  我还是很难理解这样的思想。我的88ms的就不贴了

LeetCode() Issomorphic Strings的更多相关文章

  1. LeetCode——Add Strings

    LeetCode--Add Strings Question Given two non-negative integers num1 and num2 represented as string, ...

  2. [LeetCode] Add Strings 字符串相加

    Given two non-negative numbers num1 and num2 represented as string, return the sum of num1 and num2. ...

  3. [LeetCode] Isomorphic Strings 同构字符串

    Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the chara ...

  4. [LeetCode] Multiply Strings 字符串相乘

    Given two numbers represented as strings, return multiplication of the numbers as a string. Note: Th ...

  5. LeetCode Add Strings

    原题链接在这里:https://leetcode.com/problems/add-strings/ 题目: Given two non-negative numbers num1 and num2  ...

  6. [LeetCode] Buddy Strings 伙计字符串

    Given two strings A and B of lowercase letters, return true if and only if we can swap two letters i ...

  7. [leetcode]Multiply Strings @ Python

    原题地址:https://oj.leetcode.com/problems/multiply-strings/ 题意: Given two numbers represented as strings ...

  8. LeetCode:Multiply Strings

    题目链接 Given two numbers represented as strings, return multiplication of the numbers as a string. Not ...

  9. [LeetCode] Isomorphic Strings

    Isomorphic Strings Total Accepted: 30898 Total Submissions: 120944 Difficulty: Easy Given two string ...

随机推荐

  1. package

    1.设计package原因 理解基目录的概念,思考jre加载class的顺序,如果没有package会怎么样?有了之后又是怎么样..? 主要:确保类名的唯一性. 次要:方便组织代码 2.怎样访问\导入 ...

  2. springboot

    http://7player.cn/2015/08/30/%E3%80%90%E5%8E%9F%E5%88%9B%E3%80%91%E5%9F%BA%E4%BA%8Espringboot-mybati ...

  3. centos7中 npm install express 时Error: Cannot find module 'express'错误

    费了很大劲最后在网上找到,在自己的工程目录下再次执行npm install express搞定.

  4. 0020 Linux 文件操作命令

    1. 创建文件 touch 文件名 2. 删除文件 rm 文件名 3. 复制文件 cp 源文件 目录 4.剪切文件 mv 源文件 目标文件 5.重命名文件 mv 源文件名 新文件名 6.改变文件权限 ...

  5. 0517 Scrum 项目4.0

    Sprint 1看板: 任务认领(一种标签颜色代表一个人的任务): 许佳仪:紫色 柯晓君:红色 赖文亮:蓝色 卓宇靖:黑色 每日例会的时间:16:00     地点:课室 成员 团队贡献分 许佳仪 1 ...

  6. 两种PHP生成二维码的方法

    PHP生成二维码,个人认为最常用的有两种,1.使用google的api生成,2.使用PHP QR Code生成,两种方法生成的二维码都是很清淅的,效果不错.下面来分别说明这两种方法如何实现. 一.PH ...

  7. 在python中使用matplotlib中的Matplotlib-Animation “No MovieWriters Available”

    在使用官方的示例代码中,一部分使用了ffmpeg 在执行时会报如题一样的错误 解决: 下载windows的版本,解压,然后将bin目录加入系统环境变量的路径中 如:D:\Program Files\f ...

  8. B:冷血格斗场

    总时间限制: 1000ms 内存限制: 65536kB描述为了迎接08年的奥运会,让大家更加了解各种格斗运动,facer新开了一家冷血格斗场.格斗场实行会员制,但是新来的会员不需要交入会费,而只要同一 ...

  9. 模拟系列(一)——数字电路

    要求 简要模拟数字电路的运行过程,及电位(简化为L和H),用C# WinForm实现. 思路 逻辑部分 电路是一种图结构,基于C#的特性,设计Node类(结点)和Wire类(连线),且为泛型. 由于电 ...

  10. Android开发--Layout元素

    1.TF类型 android:layout_alignParentStart="true/flase":贴紧父元素的左边缘 android:layout_alignParentEn ...