Skip to content

Commit b7811fb

Browse files
authored
Merge pull request #6 from workingjubilee/multiple-choice-answers
Multiple-answer problems need `assert!(matches!(expr, pat | pat)`
2 parents 5b22b46 + 794c36d commit b7811fb

File tree

1 file changed

+6
-6
lines changed
  • leetcode/src/00451_sort_characters_by_frequency

1 file changed

+6
-6
lines changed

Diff for: leetcode/src/00451_sort_characters_by_frequency/solution.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ mod tests {
2323

2424
#[test]
2525
fn test() {
26-
let s = String::from("tree");
27-
assert_eq!(Solution::frequency_sort(s), String::from("eert"));
26+
let s = Solution::frequency_sort("tree".to_string());
27+
assert!(matches!(&*s, "eert" | "eetr"));
2828

29-
let s = String::from("cccaaa");
30-
assert_eq!(Solution::frequency_sort(s), String::from("aaaccc"));
29+
let s = Solution::frequency_sort("cccaaa".to_string());
30+
assert!(matches!(&*s, "aaaccc" | "cccaaa"));
3131

32-
let s = String::from("Aabb");
33-
assert_eq!(Solution::frequency_sort(s), String::from("bbAa"));
32+
let s = Solution::frequency_sort("Aabb".to_string());
33+
assert!(matches!(&*s, "bbAa" | "bbaA"));
3434
}
3535
}

0 commit comments

Comments
 (0)