Leetcode 205 Solution
This article provides solution to leetcode question 205 (isomorphic-strings)
Access this page by simply typing in "lcs 205" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
https://leetcode.com/problems/isomorphic-strings
Solution
class Solution {
public:
bool isIsomorphic(string s, string t) {
if (s.size() != t.size())
return false;
char a[256] = {0};
char b[256] = {0};
for (int i = 0; i < s.size(); i++)
{
if (a[s[i]] != b[t[i]])
return false;
a[s[i]] = i + 1;
b[t[i]] = i + 1;
}
return true;
}
};