java.lang.Object
g1301_1400.s1347_minimum_number_of_steps_to_make_two_strings_anagram.Solution

public class Solution extends Object
1347 - Minimum Number of Steps to Make Two Strings Anagram.<p>Medium</p> <p>You are given two strings of the same length <code>s</code> and <code>t</code>. In one step you can choose <strong>any character</strong> of <code>t</code> and replace it with <strong>another character</strong>.</p> <p>Return <em>the minimum number of steps</em> to make <code>t</code> an anagram of <code>s</code>.</p> <p>An <strong>Anagram</strong> of a string is a string that contains the same characters with a different (or the same) ordering.</p> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> s = &ldquo;bab&rdquo;, t = &ldquo;aba&rdquo;</p> <p><strong>Output:</strong> 1</p> <p><strong>Explanation:</strong> Replace the first &lsquo;a&rsquo; in t with b, t = &ldquo;bba&rdquo; which is anagram of s.</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> s = &ldquo;leetcode&rdquo;, t = &ldquo;practice&rdquo;</p> <p><strong>Output:</strong> 5</p> <p><strong>Explanation:</strong> Replace &lsquo;p&rsquo;, &lsquo;r&rsquo;, &lsquo;a&rsquo;, &lsquo;i&rsquo; and &lsquo;c&rsquo; from t with proper characters to make t anagram of s.</p> <p><strong>Example 3:</strong></p> <p><strong>Input:</strong> s = &ldquo;anagram&rdquo;, t = &ldquo;mangaar&rdquo;</p> <p><strong>Output:</strong> 0</p> <p><strong>Explanation:</strong> &ldquo;anagram&rdquo; and &ldquo;mangaar&rdquo; are anagrams.</p> <p><strong>Constraints:</strong></p> <ul> <li><code>1 <= s.length <= 5 * 10<sup>4</sup></code></li> <li><code>s.length == t.length</code></li> <li><code>s</code> and <code>t</code> consist of lowercase English letters only.</li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details