Skip to content

Commit a0f6c9a

Browse files
committed
isomorphic strings
1 parent ac07936 commit a0f6c9a

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from typing import List, Union, Collection, Mapping, Optional
2+
from abc import ABC, abstractmethod
3+
4+
class Solution:
5+
def isIsomorphic(self, s: str, t: str) -> bool:
6+
7+
return len(set(zip(s,t))) == len(set(s)) == len(set(t))
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import unittest
2+
from src.my_project.interviews.top_150_questions_round_12\
3+
.isomorphic_strings import Solution
4+
5+
6+
class IsomorphicStringsTestCase(unittest.TestCase):
7+
8+
def test_are_isomorphic_strings(self):
9+
solution = Solution()
10+
output = solution.isIsomorphic(s="egg", t="add")
11+
self.assertTrue(output)
12+
13+
def test_are_not_isomorphic_strings(self):
14+
solution = Solution()
15+
output = solution.isIsomorphic(s="foo", t="bar")
16+
self.assertFalse(output)

0 commit comments

Comments
 (0)