Taking a look at another Algorithm this week, we’re tackling Isomorphic Strings. What are they and how in the world can we determine if the strings we have are Isomorphic or not? Let’s look at the definition below and get started:
“Two strings, X and Y , are called isomorphic if all occurrences of each character in X can be replaced with another character to get Y and vice-versa. For example, consider strings ACAB and XCXY .”
Please click the link below to view the Problem Statement
Isomorphic Strings - LeetCode
Given two strings s and t, determine if they are isomorphic. Two strings s and t are isomorphic if the characters in s…
My solution was the following:
Although my solution worked, it was not very fast on the time complexity spectrum. As always, here is a faster, optimal, one liner solution.
Using the spread operator, mapping through each element of the string and comparing the index to the other string. Genius!
Thank you so much for stopping by! Stay tuned for more Algorithm Content!
Stephanie Segura - Lone Star College - Houston, Texas, United States | LinkedIn
Hi there! My name is Stephanie. I am a Full-Stack Software Engineer residing in Houston, TX. Building on my business…