1347. Minimum Number of Steps to Make Two Strings Anagram
1347. Minimum Number of Steps to Make Two Strings Anagram
Description
You are given two strings of the same length s
and t
. In one step you can choose any character of t
and replace it with another character .
Return the minimum number of steps to make t
an anagram of s
.
An Anagram of a string is a string that contains the same characters with a different (or the same) ordering.
Example 1:
1 | Input: s = "bab", t = "aba" |
Example 2:
1 | Input: s = "leetcode", t = "practice" |
Example 3:
1 | Input: s = "anagram", t = "mangaar" |
Constraints:
1 <= s.length <= 5 * 10^4
s.length == t.length
s
andt
consist of lowercase English letters only.
Hints/Notes
- 2025/02/27 Q3
- counting
- Leetcode solution
Solution
Language: C++
1 | class Solution { |