Isomorphic Strings Solution with HashMaps

🔹 Day 37: Isomorphic Strings (LeetCode #205) 📌 Problem Statement: Given two strings s and t, determine if they are isomorphic — meaning each character in s can be replaced to get t, while maintaining order and uniqueness of mapping. ✅ My Approach: I used two HashMaps to track character mappings in both directions — one from s → t and another from t → s. While iterating through each character pair, I ensured that: A character maps consistently to the same one. No two characters map to the same character. 📊 Complexity: Time Complexity: O(n) Space Complexity: O(n) ⚡ Submission Stats: Runtime: 24 ms (Beats 12.67%) Memory: 42.46 MB (Beats 72.43%) 💡 Reflection: This problem deepened my understanding of bidirectional mapping and consistency checks in string transformations. Elegant use of HashMaps for ensuring one-to-one character relationships! 🔁 #LeetCode #Java #HashMap #Strings #100DaysOfCode #Day37

  • graphical user interface, text, application

To view or add a comment, sign in

Explore content categories