Weekly leetcode training with Rust, start from 2025/02/20.
-
045 - Jump Game II (2025/03/15) problem link solution
-
046 - Permutations (2025/03/29) problem link solution
-
047 - Permutations II (2025/04/03) problem link solution
-
048 - Rotate Image (2025/04/03) problem link solution
-
049 - Group Anagrams (2025/04/12) problem link solution
-
050 - Pow(x, n) (2025/04/19) problem link solution
-
053 - Maximum Subarray (2025/05/11) problem link solution
-
054 - Spiral Matrix (2025/05/17) problem link solution
-
055 - Jump Game (2025/05/25) problem link solution
-
056 - Merge Intervals (2025/06/14) problem link solution
-
057 - Insert Intervals (2025/06/28) 👈 problem link solution
-
044 - Wildcard Matching (2025/02/20) problem link solution
-
051 - N-Queens (2025/04/26) problem link solution
-
052 - N-Queens II (2025/05/03) problem link solution
Rust cargo unit test example:
wildcard_matching.rs:
impl Solution {
pub fn is_match(s: String, p: String) -> bool {
...
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_basic() {
let s = "abc".to_string();
let p = "a?c".to_string();
// Replace false with the correct expected output when implemented.
assert_eq!(Solution::is_match(s, p), true);
}
#[test]
fn test_edge_case() {
let s = "".to_string();
let p = "".to_string();
assert_eq!(Solution::is_match(s, p), true);
}
}
cargo cli:
cargo test hard::wildcard_matching