242. Valid Anagram--LeetCode Record
Given two strings s and t, write a function to determine if t is an anagram of s.
For example,
s = “anagram”, t = “nagaram”, return true.
s = “rat”, t = “car”, return false.
class Solution {
func isAnagram(s: String, _ t: String) -> Bool {
if s.characters.count != t.characters.count {
return false
}
return s.characters.sort() == t.characters.sort()
}
}
Test Case
""
""
"anagram"
"nagaram"
"rat"
"car"
"rat"
"-car"
相關文章
- react-recordReact
- Daily record-SeptemberAI
- 實戰 Java 16 值型別 Record - 2. Record 的基本用法Java型別
- pl/sql record 詳解SQL
- delete duplication record in sql serverdeleteSQLServer
- spring - mvc - @ValidSpringMVC
- Java 16 新特性:record類Java
- Erlang中的Record詳解
- 淺析 record 使用場景
- Record It for Mac錄屏軟體Mac
- Java 21 新特性:Record PatternsJava
- 脫離rails 使用Active RecordAI
- Homework record-Simple sorting
- gorm忽略報錯: record not foundGoORM
- CSS :valid 選擇器CSS
- 941. Valid Mountain ArrayAI
- fatal: Not a valid object name: 'master'ObjectAST
- Leetcode Valid NumberLeetCode
- Leetcode Valid ParenthesesLeetCode
- 演算法Valid Parentheses演算法
- Leetcode Valid AnagramLeetCode
- Leetcode Valid SudokuLeetCode
- 《雜湊表》242. 有效的字母異位詞《leetcode》LeetCode
- Warning:dns_get_record():AtemporaryservererroroccurredDNSServerError
- Record for Individual Project ( Word frequency program )Project
- Using Statspack to Record Explain Plan DetailsAI
- record:記錄(帶名元組)
- 不好分類的好題Record
- Caused by: Error: ' ' is not a valid resource name characterError
- Please provide a valid cache pathIDE
- Leetcode 36 Valid SudokuLeetCode
- Leetcode 20 Valid ParenthesesLeetCode
- await is only valid in async functionAIFunction
- Leetcode Valid PalindromeLeetCode
- Leetcode-Valid SudokuLeetCode
- Leetcode-Valid ParenthesesLeetCode
- Leetcode-Valid NumberLeetCode
- Valid Sudoku leetcode javaLeetCodeJava