Class Solution

java.lang.Object
g0201_0300.s0205_isomorphic_strings.Solution

public class Solution extends Object
205 - Isomorphic Strings.<p>Easy</p> <p>Given two strings <code>s</code> and <code>t</code>, <em>determine if they are isomorphic</em>.</p> <p>Two strings <code>s</code> and <code>t</code> are isomorphic if the characters in <code>s</code> can be replaced to get <code>t</code>.</p> <p>All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same character, but a character may map to itself.</p> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> s = &ldquo;egg&rdquo;, t = &ldquo;add&rdquo;</p> <p><strong>Output:</strong> true</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> s = &ldquo;foo&rdquo;, t = &ldquo;bar&rdquo;</p> <p><strong>Output:</strong> false</p> <p><strong>Example 3:</strong></p> <p><strong>Input:</strong> s = &ldquo;paper&rdquo;, t = &ldquo;title&rdquo;</p> <p><strong>Output:</strong> true</p> <p><strong>Constraints:</strong></p> <ul> <li><code>1 <= s.length <= 5 * 10<sup>4</sup></code></li> <li><code>t.length == s.length</code></li> <li><code>s</code> and <code>t</code> consist of any valid ascii character.</li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • isIsomorphic

      public boolean isIsomorphic(String s, String t)