Minimum Number of Steps to Make Two Strings Anagram LeetCode solution in Python

1
class Solution:
2
def minSteps(self, s: str, t: str) -> int:
3
for ch in s:
4
# Find and replace only one occurence of this character in t
5
t = t.replace(ch, "", 1)
6

7
return len(t)

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0