From e6daa392e47ea4992401d345c18f91d146f0e245 Mon Sep 17 00:00:00 2001 From: ankit351104 <91881708+ankit351104@users.noreply.github.com> Date: Thu, 27 Oct 2022 17:04:30 +0530 Subject: [PATCH] Isomorphic Strings (Leetcode 205) In this solution i;ve shown how can we use two HashMaps. Also, Once you solve this question, I would recommend you to solve Leetcode 890 (https://leetcode.com/problems/find-and-replace-pattern/) as both are pretty similar and you will get a better idea about why are we using two maps. CHEERS!! --- Easy/Isomorphic Strings.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Easy/Isomorphic Strings.java diff --git a/Easy/Isomorphic Strings.java b/Easy/Isomorphic Strings.java new file mode 100644 index 0000000..2a20cd3 --- /dev/null +++ b/Easy/Isomorphic Strings.java @@ -0,0 +1,20 @@ +class Solution { + public boolean isIsomorphic(String s, String t) { + HashMap map1 = new HashMap<>(); + HashMap map2 = new HashMap<>(); + for(int i=0; i