File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 59
59
| 202 | [ Happy Number] ( https://leetcode.com/problems/happy-number ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( src/HappyNumber.java ) [ ![ Python] ( https://img.icons8.com/color/35/000000/python.png )] ( python/happy_number.py ) |
60
60
| 203 | [ Remove Linked List Elements] ( https://leetcode.com/problems/remove-linked-list-elements ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( src/RemoveLinkedListElements.java ) [ ![ Python] ( https://img.icons8.com/color/35/000000/python.png )] ( python/remove_linked_list_elements.py ) |
61
61
| 204 | [ Count Primes] ( https://leetcode.com/problems/count-primes ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( src/CountPrimes.java ) [ ![ Python] ( https://img.icons8.com/color/35/000000/python.png )] ( python/count_primes.py ) |
62
- | 205 | [ Isomorphic Strings] ( https://leetcode.com/problems/isomorphic-strings ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( src/IsomorphicStrings.java ) |
62
+ | 205 | [ Isomorphic Strings] ( https://leetcode.com/problems/isomorphic-strings ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( src/IsomorphicStrings.java ) [ ![ Python ] ( https://img.icons8.com/color/35/000000/python.png )] ( python/isomorphic_strings.py ) |
63
63
| 206 | [ Reverse Linked Lists] ( https://leetcode.com/problems/reverse-linked-list ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( src/ReverseLinkedList.java ) |
64
64
| 217 | [ Contains Duplicate] ( https://leetcode.com/problems/contains-duplicate ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( src/ContainsDuplicate.java ) |
65
65
| 219 | [ Contains Duplicate II] ( https://leetcode.com/problems/contains-duplicate-ii ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( src/ContainsDuplicateII.java ) |
Original file line number Diff line number Diff line change
1
+ from typing import Dict
2
+
3
+
4
+ class Solution :
5
+ def isIsomorphic (self , s : str , t : str ) -> bool :
6
+ mapping = {}
7
+ mapped_chars = set ()
8
+ for char_s , char_t in zip (s , t ):
9
+ if char_s in mapping :
10
+ if mapping [char_s ] != char_t :
11
+ return False
12
+ else :
13
+ if char_t in mapped_chars :
14
+ return False
15
+ mapping [char_s ] = char_t
16
+ mapped_chars .add (char_t )
17
+ return True
You can’t perform that action at this time.
0 commit comments