Grokking the Engineering Manager Coding Interview
Ask Author
Back to course home

0% completed

Vote For New Content
Solution: Minimum Number of Steps to Make Two Strings Anagram
On this page

Problem Statement

Given two strings, s and t, of the same length, return the minimum number of steps required to make t an anagram of s.

In each step, you can replace any character in t with another character.

An anagram of a string is a string that contains the same characters in any order.

Examples

Example 1:

  • Input: s = "designgurus", t = "garumdespgn"
  • Expected Output: 3
  • Justification: We need to replace a, m, and p characters in the string t to match the frequency of characters in s.

Example 2:

.....

.....

.....

Like the course? Get enrolled and start learning!

On this page