Skip to content

Commit db166fe

Browse files
authored
Merge pull request #1306 from ivan1016017/june18
adding algo
2 parents 6a0090c + 54fb1b2 commit db166fe

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed
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: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import unittest
2+
from src.my_project.interviews.top_150_questions_round_17\
3+
.isomorphic_strings import Solution
4+
5+
class IsomorphicStringsTestCase(unittest.TestCase):
6+
7+
def test_are_isomorphic_strings(self):
8+
solution = Solution()
9+
output = solution.isIsomorphic(s="egg", t="add")
10+
self.assertTrue(output)
11+
12+
def test_are_not_isomorphic_strings(self):
13+
solution = Solution()
14+
output = solution.isIsomorphic(s="foo", t="bar")
15+
self.assertFalse(output)

0 commit comments

Comments
 (0)