242. Valid Anagram Easy
1/**
2 * [242] Valid Anagram
3 *
4 * Given two strings s and t, return true if t is an anagram of s, and false otherwise.
5 * An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.
6 *
7 * Example 1:
8 * Input: s = "anagram", t = "nagaram"
9 * Output: true
10 * Example 2:
11 * Input: s = "rat", t = "car"
12 * Output: false
13 *
14 * Constraints:
15 *
16 * 1 <= s.length, t.length <= 5 * 10^4
17 * s and t consist of lowercase English letters.
18 *
19 *
20 * Follow up: What if the inputs contain Unicode characters? How would you adapt your solution to such a case?
21 *
22 */
23pub struct Solution {}
24
25// problem: https://leetcode.com/problems/valid-anagram/
26// discuss: https://leetcode.com/problems/valid-anagram/discuss/?currentPage=1&orderBy=most_votes&query=
27
28// submission codes start here
29
30impl Solution {
31 pub fn is_anagram(s: String, t: String) -> bool {
32 false
33 }
34}
35
36// submission codes end
37
38#[cfg(test)]
39mod tests {
40 use super::*;
41
42 #[test]
43 fn test_242() {
44 }
45}
46
Back
© 2025 bowen.ge All Rights Reserved.