Shawn's Blog

  • Home
  • Tags
  • Categories
  • Archives
  • Search
  • Table of Contents
  • Overview

Shawn

若有恒,何必三更眠五更起;最无益,莫过一日曝十日寒。
392 posts
13 categories
114 tags

LeetCode 205. Isomorphic Strings

Posted on 2020-12-27 Edited on 2024-11-24 In LeetCode
1
2
3
4
5
6
7
8
9
10
11
12
class Solution {
public:
bool isIsomorphic(string s, string t) {
int m1[256] = {0}, m2[256] = {0};
for (int i = 0; i < s.size(); ++i) {
if (m1[s[i]] != m2[t[i]]) return false;
m1[s[i]] = i + 1;
m2[t[i]] = i + 1;
}
return true;
}
};
# Hash Table
LeetCode 85. Maximal Rectangle
LeetCode 188. Best Time to Buy and Sell Stock IV
© 2024 Shawn
Powered by Hexo & NexT.Mist
0%