Re: [閒聊] 每日LeetCode

作者: Rushia (みけねこ的鼻屎)   2024-01-14 02:26:19
※ 引述《JerryChungYC (JerryChung)》之銘言:
: https://leetcode.com/problems/minimum-number-of-steps-to-make-two-strings-
: anagram
: 1347. Minimum Number of Steps to Make Two Strings Anagram
: 給兩個長度相同的字串s和t,每次可以從t選一個字元換成其他字,求把t變成s的最小次數
: 只要包含的字元相同就好,順序可以不同(Anagram)。
: Example 1:
: Input: s = "bab", t = "aba"
: Output: 1
: Explanation: Replace the first 'a' in t with b, t = "bba" which is anagram of s.
: Example 2:
: Input: s = "leetcode", t = "practice"
: Output: 5
: Explanation: Replace 'p', 'r', 'a', 'i' and 'c' from t with proper characters
: to make t anagram of s.
: Example 3:
: Input: s = "anagram", t = "mangaar"
: Output: 0
: Explanation: "anagram" and "mangaar" are anagrams.
: Python3 Code:
:
作者: JerryChungYC (JerryChung)   2024-01-14 02:30:00
看到很多答案都這樣寫 不過窩還沒理解 :o感覺有點懂了 謝謝捏 話說週挑戰是要報名才有的嗎為了報名去建了linkedin結果發現不用填資料也可

Links booklink

Contact Us: admin [ a t ] ucptt.com